forked from Ch0pin/medusa
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
More native functionality added, socket hooks
- Loading branch information
Showing
5 changed files
with
191 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
#Description: 'Monitor calls to socket operations' | ||
#Help: https://codeshare.frida.re/@ninjadiary/frinja---sockets/ | ||
-webSocketClient constructor | ||
-send | ||
|
||
#Code: | ||
|
||
|
||
console.log('-----------------Author: secretdiary.ninja-----------------'); | ||
|
||
|
||
var sock = Java.use("java.net.Socket"); | ||
|
||
// Socket.bind() | ||
sock.bind.implementation = function(localAddress){ | ||
console.log("Socket.bind("+localAddress.toString()+")"); | ||
sock.bind.call(this, localAddress); | ||
} | ||
|
||
// Socket.connect(endPoint) | ||
sock.connect.overload("java.net.SocketAddress").implementation = function(endPoint){ | ||
console.log("Socket.connect("+endPoint.toString()+")"); | ||
sock.connect.overload("java.net.SocketAddress").call(this, endPoint); | ||
} | ||
|
||
// Socket.connect(endPoint, timeout) | ||
sock.connect.overload("java.net.SocketAddress", "int").implementation = function(endPoint, tmout){ | ||
console.log("Socket.connect("+endPoint.toString()+", Timeout: "+tmout+")"); | ||
sock.connect.overload("java.net.SocketAddress", "int").call(this, endPoint, tmout); | ||
} | ||
|
||
// Socket.getInetAddress() | ||
sock.getInetAddress.implementation = function(){ | ||
ret = sock.getInetAddress.call(this); | ||
console.log(ret.toString()+" Socket.getInetAddress()"); | ||
return ret; | ||
} | ||
|
||
// Socket.getInputStream() | ||
sock.getInputStream.implementation = function(){ | ||
console.log("Socket.getInputStream()"); | ||
return sock.getInputStream.call(this); | ||
} | ||
|
||
// Socket.getOutputStream() | ||
sock.getOutputStream.implementation = function(){ | ||
console.log("Socket.getOutputStream()"); | ||
return sock.getOutputStream.call(this); | ||
} | ||
|
||
sock.$init.overload().implementation = function(){ | ||
console.log("new Socket() called"); | ||
this.$init.overload().call(this); | ||
} | ||
|
||
// new Socket(inetAddress, port) | ||
sock.$init.overload("java.net.InetAddress", "int").implementation = function(inetAddress, port){ | ||
console.log("new Socket('"+inetAddress.toString()+"', "+port+") called"); | ||
this.$init.overload("java.net.InetAddress", "int").call(this, inetAddress, port); | ||
} | ||
|
||
// new Socket(inetAddress address, port, localInetAddress, localPort) | ||
sock.$init.overload("java.net.InetAddress", "int","java.net.InetAddress", "int").implementation = function(inetAddress, port, localInet, localPort){ | ||
console.log("new Socket(RemoteInet: '"+inetAddress.toString()+"', RemotePort"+port+", LocalInet: '"+localInet+"', LocalPort: "+localPort+") called"); | ||
this.$init.overload("java.net.InetAddress", "int","java.net.InetAddress", "int").call(this, inetAddress, port); | ||
} | ||
|
||
// new Socket(Proxy) | ||
sock.$init.overload("java.net.Proxy").implementation = function(proxy){ | ||
console.log("new Socket(Proxy: '"+proxy.toString()+"') called"); | ||
this.$init.overload("java.net.Proxy").call(this, proxy); | ||
} | ||
|
||
// new Socket(SocketImp) | ||
sock.$init.overload("java.net.SocketImpl").implementation = function(si){ | ||
console.log("new Socket(SocketImpl: '"+si.toString()+"') called"); | ||
this.$init.overload("java.net.SocketImpl").call(this, si); | ||
} | ||
|
||
// new Socket(host, port, localInetAddr, localPort) | ||
sock.$init.overload("java.lang.String", "int", "java.net.InetAddress", "int").implementation = function(host,port, localInetAddress, localPort){ | ||
console.log("new Socket(Host: '"+host+"', RemPort: "+port+", LocalInet: '"+localInetAddress+"', localPort: "+localPort+") called"); | ||
this.$init.overload("java.lang.String", "int", "java.net.InetAddress", "int").call(this, si); | ||
} |