File tree Expand file tree Collapse file tree 1 file changed +42
-0
lines changed Expand file tree Collapse file tree 1 file changed +42
-0
lines changed Original file line number Diff line number Diff line change @@ -90,5 +90,47 @@ def main():
9090if listen :
9191 server_loop ()
9292
93+ def client_sender (buffer ):
94+
95+ client = socket .socket (socket .AF_INET , socket .SOCK_STREAM )
96+
97+ try :
98+ # connect to target host
99+ client .connect ((target , port ))
100+
101+ if len (buffer ):
102+ client .send (buffer )
103+
104+ while True :
105+
106+ # wait for data back
107+ recv_len = 1
108+ response = ""
109+
110+ while recv_len :
111+
112+ data = client .recv (4096 )
113+ recv_len = len (data )
114+ response += data
115+
116+ if recv_len < 4096 :
117+ break
118+
119+ print response ,
120+
121+ # wait for more input
122+ buffer = raw_input ("" )
123+ buffer += "\n "
124+
125+ # send it off
126+ client .send (buffer )
127+
128+ except :
129+
130+ print "[*] Exception! Exiting."
131+
132+ # tear down connection
133+ client .close ()
134+
93135main ()
94136
You can’t perform that action at this time.
0 commit comments