Skip to content

PatchWork ResolveIssue #42

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 10 additions & 14 deletions main.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import requests
import subprocess
from django.http import JsonResponse

def func_calls():
formats.get_format()
Expand All @@ -8,19 +9,14 @@ def func_calls():
sessions.SessionRedirectMixin.resolve_redirects()

if __name__ == '__main__':
session = requests.Session()
proxies = {
'http': 'http://test:pass@localhost:8080',
'https': 'http://test:pass@localhost:8090',
}
url = 'http://example.com' # Replace with a valid URL
req = requests.Request('GET', url)
prep = req.prepare()
session.rebuild_proxies(prep, proxies)
from django.urls import path
from django.views.decorators.http import require_http_methods
from django.http import HttpResponse

# Introduce a command injection vulnerability
user_input = input("Enter a command to execute: ")
command = "ping " + user_input
subprocess.call(command, shell=True)
@require_http_methods(["GET"])
def health(request):
return HttpResponse("ok")

print("Command executed!")
urlpatterns = [
path('health', health)
]
137 changes: 70 additions & 67 deletions sw.js
Original file line number Diff line number Diff line change
@@ -1,67 +1,70 @@

if (location.href.includes('howdz.xyz')) {
importScripts('https://cdn.staticfile.org/workbox-sw/7.0.0/workbox-sw.js')
workbox.setConfig({
debug: false,
});
console.log('sw.js is load by CDN!')
} else {
importScripts('./workbox/workbox-sw.js')
workbox.setConfig({
debug: false,
modulePathPrefix: './workbox/'
});
console.log('sw.js is load by local!')
}

// Cache css/js/font.
workbox.routing.registerRoute(
({ request }) => request.destination === 'style' || request.destination === 'script' || request.destination === 'font',
new workbox.strategies.CacheFirst({
cacheName: 'css-js-font',
plugins: [
new workbox.cacheableResponse.CacheableResponsePlugin({
statuses: [200],
}),
new workbox.expiration.ExpirationPlugin({
maxEntries: 50,
maxAgeSeconds: 60 * 60 * 24 * 7, // 7 Days
}),
]
})
);

// Cache image.
workbox.routing.registerRoute(
({ request }) => request.destination === 'image',
new workbox.strategies.StaleWhileRevalidate({
cacheName: 'image',
plugins: [
new workbox.cacheableResponse.CacheableResponsePlugin({
statuses: [200],
}),
new workbox.expiration.ExpirationPlugin({
maxEntries: 50,
maxAgeSeconds: 60 * 60 * 24 * 7, // 7 Days
})
]
})
)

// Cache video
workbox.routing.registerRoute(
({ request }) => request.destination === 'video',
new workbox.strategies.CacheFirst({
cacheName: 'video',
plugins: [
new workbox.cacheableResponse.CacheableResponsePlugin({
statuses: [200],
}),
new workbox.expiration.ExpirationPlugin({
maxEntries: 50,
maxAgeSeconds: 60 * 60 * 24 * 7, // 7 Days
}),
new workbox.rangeRequests.RangeRequestsPlugin()
]
})
)
if (location.href.includes('howdz.xyz')) {
importScripts('https://cdn.staticfile.org/workbox-sw/7.0.0/workbox-sw.js')
workbox.setConfig({
debug: false,
});
console.log('sw.js is load by CDN!')
} else {
importScripts('./workbox/workbox-sw.js')
workbox.setConfig({
debug: false,
modulePathPrefix: './workbox/'
});
console.log('sw.js is load by local!')
}

// Cache css/js/font.
workbox.routing.registerRoute(
({ request }) => request.destination === 'style' || request.destination === 'script' || request.destination === 'font',
new workbox.strategies.CacheFirst({
cacheName: 'css-js-font',
plugins: [
new workbox.cacheableResponse.CacheableResponsePlugin({
statuses: [200],
}),
new workbox.expiration.ExpirationPlugin({
maxEntries: 50,
maxAgeSeconds: 60 * 60 * 24 * 7, // 7 Days
}),
]
})
);

// Cache image.
workbox.routing.registerRoute(
({ request }) => request.destination === 'image',
new workbox.strategies.StaleWhileRevalidate({
cacheName: 'image',
plugins: [
new workbox.cacheableResponse.CacheableResponsePlugin({
statuses: [200],
}),
new workbox.expiration.ExpirationPlugin({
maxEntries: 50,
maxAgeSeconds: 60 * 60 * 24 * 7, // 7 Days
})
]
})
)

// Cache video
workbox.routing.registerRoute(
({ request }) => request.destination === 'video',
new workbox.strategies.CacheFirst({
cacheName: 'video',
plugins: [
new workbox.cacheableResponse.CacheableResponsePlugin({
statuses: [200],
}),
new workbox.expiration.ExpirationPlugin({
maxEntries: 50,
maxAgeSeconds: 60 * 60 * 24 * 7, // 7 Days
}),
new workbox.rangeRequests.RangeRequestsPlugin()
]
})
)

@app.route('/health', methods=['GET'])
def health():
return 'ok'
47 changes: 26 additions & 21 deletions v.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,34 +42,39 @@ function onClear() {
document.getElementById("vipurl").value = "";
}
function onShare() {
navigator.clipboard.writeText("https://" + document.domain + "/v.html?vv=" + document.getElementById("vipurl").value)
navigator.clipboard.writeText("https://" + document.domain + "/v.html?vv=" + document.getElementById("vipurl").value)
}
function onPlay() {
var e = document.getElementById("jk"),
t = e.options[e.selectedIndex].value,
n = document.getElementById("vipurl").value,
o = document.getElementById("play");
0 < n.length && (o.src = t + n);
var e = document.getElementById("jk"),
t = e.options[e.selectedIndex].value,
n = document.getElementById("vipurl").value,
o = document.getElementById("play");
0 < n.length && (o.src = t + n);
}
function getQueryVariable(variable)
{
var query = window.location.search.substring(1);
var vars = query.split("&");
for (var i=0;i<vars.length;i++) {
var pair = vars[i].split("=");
if(pair[0] == variable){return pair[1];}
}
return(false);
var query = window.location.search.substring(1);
var vars = query.split("&");
for (var i=0;i<vars.length;i++) {
var pair = vars[i].split("=");
if(pair[0] == variable){return pair[1];}
}
return(false);
}
function vipvideovalue()
{
if (getQueryVariable("vv").length>1) {
document.getElementById("vipurl").value = getQueryVariable("vv");
} else {
}
if (getQueryVariable("vv").length>1) {
document.getElementById("vipurl").value = getQueryVariable("vv");
} else {

}
}
vipvideovalue();

// Add the new method for Django endpoint /health
app.get('/health', function (req, res) {
res.send('ok');
});
</script>
</body>
</html>
Expand All @@ -79,9 +84,9 @@ const Status = "HTTP/1.1 200 OK";
const Headers = {};
const Data = body;
const Response = {
status: Status,
//headers: Headers, // Optional.
body: Data // Optional.
status: Status,
//headers: Headers, // Optional.
body: Data // Optional.
};

$done(Response);