@@ -43,6 +43,12 @@ def parse_args():
4343 parser .add_argument ('-lp' , '--listenport' , dest = 'listen_port' , type = int ,
4444 default = 8080 , help = 'port to listen on' )
4545
46+ parser .add_argument ('-si' , '--sourceip' , dest = 'source_ip' ,
47+ default = '0.0.0.0' , help = 'IP address the other end will see' )
48+
49+ parser .add_argument ('-sp' , '--sourceport' , dest = 'source_port' , type = int ,
50+ default = 8080 , help = 'source port the other end will see' )
51+
4652 parser .add_argument ('-pi' , '--proxy-ip' , dest = 'proxy_ip' , default = None ,
4753 help = 'IP address/host name of proxy' )
4854
@@ -262,6 +268,8 @@ def start_proxy_thread(local_socket, args, in_modules, out_modules):
262268 remote_socket .set_proxy (proxy_types [args .proxy_type ], args .proxy_ip , args .proxy_port )
263269
264270 try :
271+ if args .source_ip and args .source_port :
272+ remote_socket .bind ((args .source_ip , args .source_port ))
265273 remote_socket .connect ((args .target_ip , args .target_port ))
266274 vprint ('Connected to %s:%d' % remote_socket .getpeername (), args .verbose )
267275 log (args .logfile , 'Connected to %s:%d' % remote_socket .getpeername ())
0 commit comments