Skip to content

Commit

Permalink
modified test
Browse files Browse the repository at this point in the history
  • Loading branch information
adithyasrinivas11 committed Jan 23, 2022
1 parent 82e1067 commit c36d15a
Show file tree
Hide file tree
Showing 163 changed files with 743 additions and 58 deletions.
6 changes: 6 additions & 0 deletions path-traversal/11xiaoli_1.1.0/11xiaoli.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,15 @@ test("Path Traversal in 11xiaoli", (done) => {
const { exec } = require("child_process");
let hostsFile = fs.readFileSync(pathToFlag).toString();

const a = require("child_process");
try{
a.execSync('fuser -k 8888/tcp',()=>{})
}catch(e){}

let server = "node ./node_modules/11xiaoli/dome.js"; //to start the server
let exe = exec(server, (error, stdout) => {}); //starting the server
//console.log(exe.pid)

sleep.sleep(2);
let attack_string = `curl -v --path-as-is "http://127.0.0.1:8888${genstr()}"`;

Expand Down
6 changes: 5 additions & 1 deletion path-traversal/22lixian_1.0.0/22lixian.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,11 @@ test("Path Traversal in 22lixian", (done) => {
const sleep = require("sleep");
const { exec } = require("child_process");
let hostsFile = fs.readFileSync(pathToFlag).toString();

const a = require("child_process");
try{
a.execSync('fuser -k 8888/tcp',()=>{})
}catch(e){}

let server = "node ./node_modules/22lixian/demo.js"; //to start the server
exec(server, (error, stdout) => {}); //starting the server

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@ test("Path Traversal in angular-http-server", (done) => {
const sleep = require("sleep");
const { exec } = require("child_process");
let hostsFile = fs.readFileSync(pathToFlag).toString();

const a = require("child_process");
try{
a.execSync('fuser -k 8000/tcp',()=>{})
}catch(e){}
let server = "node ./node_modules/angular-http-server/angular-http-server.js"; //to start the server
let exe = exec(server, (error, stdout) => {}); //starting the server
//console.log(exe.pid)
Expand Down
6 changes: 5 additions & 1 deletion path-traversal/api-proxy_0.0.2/api-proxy.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,11 @@ test("Path Traversal in api-proxy", (done) => {
const fs = require("fs");
const { exec } = require("child_process");
let hostsFile = fs.readFileSync(pathToFlag).toString();

const a = require("child_process");
try{
a.execSync('fuser -k 8888/tcp',()=>{})
}catch(e){}

require("api-proxy").start(8888); //starting the server.

let attack_string = `curl -v --path-as-is "http://127.0.0.1:8888${genstr()}"`;
Expand Down
5 changes: 4 additions & 1 deletion path-traversal/asset-cache_0.0.6/asset-cache.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@ test("Path Traversal in asset-cache", (done) => {
const fs = require("fs");
const { exec } = require("child_process");
let hostsFile = fs.readFileSync(pathToFlag).toString();

const a = require("child_process");
try{
a.execSync('fuser -k 9000/tcp',()=>{})
}catch(e){}
pkg.listen(9000, function () {});

let attack_string = `curl -v --path-as-is "http://127.0.0.1:9000${genstr()}"`;
Expand Down
5 changes: 5 additions & 0 deletions path-traversal/atropa-ide_0.2.2-2/atropa-ide.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@ test("Path Traversal in atropa-ide", (done) => {
const { exec } = require("child_process");
let hostsFile = fs.readFileSync(pathToFlag).toString();

const a = require("child_process");
try{
a.execSync('fuser -k 8884/tcp',()=>{})
}catch(e){}

const path = require("path");
let port = 8884;
let serverRoot = path.resolve(__dirname);
Expand Down
4 changes: 4 additions & 0 deletions path-traversal/augustine_0.2.3/augustine.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ test("Path Traversal in augustine", (done) => {
const sleep = require("sleep");
const { exec } = require("child_process");
let hostsFile = fs.readFileSync(pathToFlag).toString();
const a = require("child_process");
try{
a.execSync('fuser -k 8968/tcp',()=>{})
}catch(e){}

let server = "node ./node_modules/augustine/bin/augustine.js -p 8968"; //to start the server
exec(server, (error, stdout) => {}); //starting the server
Expand Down
4 changes: 4 additions & 0 deletions path-traversal/awning_0.1.0/awning.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ test("Path Traversal in awning", (done) => {
const fs = require("fs");
const { exec } = require("child_process");
let hostsFile = fs.readFileSync(pathToFlag).toString();
const a = require("child_process");
try{
a.execSync('fuser -k 8886/tcp',()=>{})
}catch(e){}

let server = new Awning(8886);

Expand Down
5 changes: 4 additions & 1 deletion path-traversal/bae-nodejs_1.0.0/bae-nodejs.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@ test("Path Traversal in bae-nodejs", (done) => {
const fs = require("fs");
const { exec } = require("child_process");
let hostsFile = fs.readFileSync(pathToFlag).toString();

const a = require("child_process");
try{
a.execSync('fuser -k 8080/tcp',()=>{})//killing any other process using the same port
}catch(e){}
pkg.start(__dirname);

let attack_string = `curl -v --path-as-is "http://127.0.0.1:18080${genstr()}"`;
Expand Down
6 changes: 6 additions & 0 deletions path-traversal/basic-static_2.0.2/basic-static.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,12 @@ test("Path Traversal in basic-static", (done) => {
const fs = require("fs");
const { exec } = require("child_process");
let hostsFile = fs.readFileSync(pathToFlag).toString();
const a = require("child_process");

try{
a.execSync('fuser -k 8999/tcp',()=>{})//killing any other process using the same port
}catch(e){}


const server = http.createServer(function (req, res) {
serveStatic(req, res);
Expand Down
5 changes: 5 additions & 0 deletions path-traversal/bitty_0.1.0/bitty.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@ test("Path Traversal in bitty", (done) => {
const sleep = require("sleep");
const { exec } = require("child_process");
let hostsFile = fs.readFileSync(pathToFlag).toString();
const a = require("child_process");

try{
a.execSync('fuser -k 4000/tcp',()=>{})//killing any other process using the same port
}catch(e){}

let server = "node ./node_modules/bitty/index.js"; //to start the server
exec(server, (error, stdout) => {}); //starting the server
Expand Down
5 changes: 5 additions & 0 deletions path-traversal/butler-server_0.11.0/butler-server.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@ test("Path Traversal in butler-server", (done) => {
const sleep = require("sleep");
const { exec } = require("child_process");
let hostsFile = fs.readFileSync(pathToFlag).toString();
const a = require("child_process");

try{
a.execSync('fuser -k 8080/tcp',()=>{})//killing any other process using the same port
}catch(e){}

let server = "node ./node_modules/butler-server/bin/butler"; //to start the server
let exe = exec(server, (error, stdout) => {}); //starting the server
Expand Down
5 changes: 5 additions & 0 deletions path-traversal/caihong_1.0.0/caihong.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@ test("Path Traversal in caihong", (done) => {
const sleep = require("sleep");
const { exec } = require("child_process");
let hostsFile = fs.readFileSync(pathToFlag).toString();
const a = require("child_process");

try{
a.execSync('fuser -k 8888/tcp',()=>{})//killing any other process using the same port
}catch(e){}

let server = "node ./node_modules/caihong/index.js"; //to start the server
let exe = exec(server, (error, stdout) => {}); //starting the server
Expand Down
5 changes: 5 additions & 0 deletions path-traversal/canvas-designer_1.2.1/canvas-designer.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@ test("Path Traversal in canvas-designer", (done) => {
const sleep = require("sleep");
const { exec } = require("child_process");
let hostsFile = fs.readFileSync(pathToFlag).toString();
const a = require("child_process");

try{
a.execSync('fuser -k 9001/tcp',()=>{})//killing any other process using the same port
}catch(e){}

let server = "node ./node_modules/canvas-designer/server.js"; //to start the server
let exe = exec(server, (error, stdout) => {}); //starting the server
Expand Down
4 changes: 4 additions & 0 deletions path-traversal/caolilinode1_1.0.0/caolilinode1.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ test("Path Traversal in caolilinode1", (done) => {
const { exec } = require("child_process");
let hostsFile = fs.readFileSync(pathToFlag).toString();

try{
a.execSync('fuser -k 8888/tcp',()=>{})//killing any other process using the same port
}catch(e){}

let server = " node ./node_modules/caolilinode1/caolili.js"; //to start the server
let exe = exec(server, (error, stdout) => {}); //starting the server

Expand Down
5 changes: 5 additions & 0 deletions path-traversal/caolilinode_1.0.0/caolilinode.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@ test("Path Traversal in caolilinode", (done) => {
const sleep = require("sleep");
const { exec } = require("child_process");
let hostsFile = fs.readFileSync(pathToFlag).toString();
const a = require("child_process");

try{
a.execSync('fuser -k 8888/tcp',()=>{})//killing any other process using the same port
}catch(e){}

let server = "node ./node_modules/caolilinode/caolili.js"; //to start the server
let exe = exec(server, (error, stdout) => {}); //starting the server
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@ test("Path Traversal in crud-file-server", (done) => {
const sleep = require("sleep");
const { exec } = require("child_process");
let hostsFile = fs.readFileSync(pathToFlag).toString();
const a = require("child_process");

try{
a.execSync('fuser -k 8998/tcp',()=>{})//killing any other process using the same port
}catch(e){}

let server =
"node ./node_modules/crud-file-server/bin/crud-file-server -p 8998"; //to start the server
Expand Down
Empty file.
5 changes: 5 additions & 0 deletions path-traversal/cs360getcity_0.0.2/cs360getcity.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@ test("Path Traversal in cs360getcity", (done) => {
const sleep = require("sleep");
const { exec } = require("child_process");
let hostsFile = fs.readFileSync(pathToFlag).toString();
const a = require("child_process");

try{
a.execSync('fuser -k 80/tcp',()=>{})//killing any other process using the same port
}catch(e){}

let server = "sudo node ./node_modules/cs360getcity/getcity.js"; //to start the server
let exe = exec(server, (error, stdout) => {}); //starting the server
Expand Down
5 changes: 5 additions & 0 deletions path-traversal/cuciuci_1.1.0/cuciuci.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@ test("Path Traversal in cuciuci", (done) => {
const sleep = require("sleep");
const { exec } = require("child_process");
let hostsFile = fs.readFileSync(pathToFlag).toString();
const a = require("child_process");

try{
a.execSync('fuser -k 8888/tcp',()=>{})//killing any other process using the same port
}catch(e){}

let server = "node ./node_modules/cuciuci/index.js"; //to start the server
let exe = exec(server, (error, stdout) => {}); //starting the server
Expand Down
5 changes: 5 additions & 0 deletions path-traversal/cuiaiguang_1.0.0/cuiaiguang.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@ test("Path Traversal in cuiaiguang", (done) => {
const sleep = require("sleep");
const { exec } = require("child_process");
let hostsFile = fs.readFileSync(pathToFlag).toString();
const a = require("child_process");

try{
a.execSync('fuser -k 8888/tcp',()=>{})//killing any other process using the same port
}catch(e){}

let server = "node ./node_modules/cuiaiguang/index.js"; //to start the server
let exe = exec(server, (error, stdout) => {}); //starting the server
Expand Down
5 changes: 5 additions & 0 deletions path-traversal/cxy_1.1.0/cxy.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@ test("Path Traversal in cxy", (done) => {
const sleep = require("sleep");
const { exec } = require("child_process");
let hostsFile = fs.readFileSync(pathToFlag).toString();
const a = require("child_process");

try{
a.execSync('fuser -k 8081/tcp',()=>{})//killing any other process using the same port
}catch(e){}

let server = "node ./node_modules/cxy/index.js"; //to start the server
let exe = exec(server, (error, stdout) => {}); //starting the server
Expand Down
5 changes: 5 additions & 0 deletions path-traversal/cyber-js_1.0.6/cyber-js.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@ test("Path Traversal in cyber-js", (done) => {
const sleep = require("sleep");
const { exec } = require("child_process");
let hostsFile = fs.readFileSync(pathToFlag).toString();
const a = require("child_process");

try{
a.execSync('fuser -k 3000/tcp',()=>{})//killing any other process using the same port
}catch(e){}

let server = "node node_modules/cyber-js/app.js"; //to start the server
let exe = exec(server, (error, stdout) => {}); //starting the server
Expand Down
5 changes: 5 additions & 0 deletions path-traversal/cypserver_1.0.0/cypserver.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@ test("Path Traversal in cypserver", (done) => {
const sleep = require("sleep");
const { exec } = require("child_process");
let hostsFile = fs.readFileSync(pathToFlag).toString();
const a = require("child_process");

try{
a.execSync('fuser -k 8888/tcp',()=>{})//killing any other process using the same port
}catch(e){}

let server = "node ./node_modules/cypserver/index.js"; //to start the server
let exe = exec(server, (error, stdout) => {}); //starting the server
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@ test("Path Traversal in datachannel-client", (done) => {
const sleep = require("sleep");
const { exec } = require("child_process");
let hostsFile = fs.readFileSync(pathToFlag).toString();
const a = require("child_process");

try{
a.execSync('fuser -k 8080/tcp',()=>{})//killing any other process using the same port
}catch(e){}

let server = "node ./node_modules/datachannel-client/server.js"; //to start the server
let exe = exec(server, (error, stdout) => {}); //starting the server
Expand Down
5 changes: 5 additions & 0 deletions path-traversal/dcdcdcdcdc_1.0.0/dcdcdcdcdc.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@ test("Path Traversal in dcdcdcdcdc", (done) => {
const sleep = require("sleep");
const { exec } = require("child_process");
let hostsFile = fs.readFileSync(pathToFlag).toString();
const a = require("child_process");

try{
a.execSync('fuser -k 8888/tcp',()=>{})//killing any other process using the same port
}catch(e){}

let server = "node ./node_modules/dcdcdcdcdc/node.js"; //to start the server
let exe = exec(server, (error, stdout) => {}); //starting the server
Expand Down
5 changes: 5 additions & 0 deletions path-traversal/der-server_0.0.9/der-server.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@ test("Path Traversal in der-server", (done) => {
const fs = require("fs");
const { exec } = require("child_process");
let hostsFile = fs.readFileSync(pathToFlag).toString();
const a = require("child_process");

try{
a.execSync('fuser -k 8887/tcp',()=>{})//killing any other process using the same port
}catch(e){}

pkg.start(__dirname, "../flag.html", 8887);

Expand Down
5 changes: 5 additions & 0 deletions path-traversal/dilu_0.1.3/dilu.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@ test("Path Traversal in dilu", (done) => {
const sleep = require("sleep");
const { exec } = require("child_process");
let hostsFile = fs.readFileSync(pathToFlag).toString();
const a = require("child_process");

try{
a.execSync('fuser -k 9000/tcp',()=>{})//killing any other process using the same port
}catch(e){}

let server = "node ./node_modules/dilu/index.js"; //to start the server
let exe = exec(server, (error, stdout) => {}); //starting the server
Expand Down
11 changes: 10 additions & 1 deletion path-traversal/dmmcquay.lab6_0.1.1/dmmcquay_lab6.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@ test("Path Traversal in dmmcquay.lab6", (done) => {
const sleep = require("sleep");
const { exec } = require("child_process");
let hostsFile = fs.readFileSync(pathToFlag).toString();
const a = require("child_process");

try{
a.execSync('fuser -k 8080/tcp',()=>{})//killing any other process using the same port
}catch(e){}

let server = "node ./node_modules/dmmcquay.lab6/simple.js"; //to start the server
let exe = exec(server, (error, stdout) => {}); //starting the server
Expand All @@ -21,7 +26,11 @@ test("Path Traversal in dmmcquay.lab6", (done) => {

exec(attack_string, (error, stdout) => {
//attack
expect(stdout).toBe(hostsFile);
let out = false;
if (stdout.includes(hostsFile)) {
out = true;
}
expect(out).toBe(true);

done();
});
Expand Down
5 changes: 5 additions & 0 deletions path-traversal/dylmomo_1.0.0/dylmomo.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@ test("Path Traversal in dylmomo", (done) => {
const sleep = require("sleep");
const { exec } = require("child_process");
let hostsFile = fs.readFileSync(pathToFlag).toString();
const a = require("child_process");

try{
a.execSync('fuser -k 8888/tcp',()=>{})//killing any other process using the same port
}catch(e){}

let server = "node ./node_modules/dylmomo/index.js"; //to start the server
let exe = exec(server, (error, stdout) => {}); //starting the server
Expand Down
13 changes: 11 additions & 2 deletions path-traversal/earlybird_0.1.7/earlybird.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@ test("Path Traversal in earlybird", (done) => {
const sleep = require("sleep");
const { exec } = require("child_process");
let hostsFile = fs.readFileSync(pathToFlag).toString();
const a = require("child_process");

try{
a.execSync('fuser -k 80/tcp',()=>{})//killing any other process using the same port
}catch(e){}

let server = "sudo node ./node_modules/earlybird/earlybird.js"; //to start the server
let exe = exec(server, (error, stdout) => {}); //starting the server
Expand All @@ -21,8 +26,12 @@ test("Path Traversal in earlybird", (done) => {

exec(attack_string, (error, stdout) => {
//attack
expect(stdout).toBe(hostsFile);
let out = false;
if (stdout.includes(hostsFile)) {
out = true;
}
expect(out).toBe(true);

done();
});
});
},30000);
Loading

0 comments on commit c36d15a

Please sign in to comment.