Skip to content
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
2 changes: 1 addition & 1 deletion tcp-req-dump/tcp-req-dump.cap
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
# we'll use this proxy script to dump requests
set tcp.proxy.script tcp-req-dump.js
set tcp.port 80
# example.com
# example.com, victim server
set tcp.address 93.184.216.34
set tcp.proxy.port 8080

Expand Down
19 changes: 14 additions & 5 deletions tcp-req-dump/tcp-req-dump.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,21 @@ function onLoad() {
log("TCP module loaded")
}

function charToInt(value) {
return value.charCodeAt()
}


function onData(from, to, data) {
if( data.indexOf("Accept-Encoding: gzip, deflate") != -1 ) {
//log(data) // 104 101 108 108 111
st_data = String.fromCharCode.apply(null, data)
log("TCP req dump String data: " + st_data) // "hello"

if( st_data.indexOf("Accept-Encoding: gzip, deflate") != -1 ) {
log("Disabling gzip response");
data = data.replace("Accept-Encoding: gzip, deflate", "Accept-Encoding: text/plain");
return data;
st_data = st_data.replace("Accept-Encoding: gzip, deflate", "Accept-Encoding: text/plain");
res_int_arr = st_data.split("").map(charToInt)
return res_int_arr
}

return data.replace(/Example/g, "POPOPOP");
return data
}