Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import socket
- import time
- import base64
- def netcat(s,content=''):
- if content:
- if content[-2::]!='\r\n':
- content = content + '\r\n'
- s.sendall(content)
- # s.shutdown(socket.SHUT_WR)
- data = s.recv(1024)
- # print "Connection closed."
- # s.close()
- return repr(data)
- username =
- password =
- def main():
- hostname =
- port =
- s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
- s.connect((hostname, port))
- start_time = time.time()
- print netcat(s)
- print("--- Connection establishment time: %s seconds ---" % (time.time() - start_time))
- start_time = time.time()
- netcat(s,'USER ' + username + '')
- print netcat(s,'PASS ' + base64.b64decode(password) + '')
- print("--- Authentication time: %s seconds ---" % (time.time() - start_time))
- start_time = time.time()
- print netcat(s,'LIST')
- print netcat(s,'QUIT')
- s.close()
- main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement