Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- __author__ = 'User'
- from socket import *
- from re import *
- import os
- import sys
- import time
- commands = ["SAVE", "ECHO", "GIVEIP", "UPTIME", "WHOAMI", "MOVETO", "RUN", "PRINTF", "GOAWAYF", "GOAWAYD", "MAKEF", "MAKED", "COPYF", "EXEC", "DL", "!CONNECT_UPTIME", "!HELP", "!ABOUT", "!LOGOUT", "PING", "GET", "SCREENSHOT"]
- connection_started = time.time()
- def main():
- soc = socket()
- ip = raw_input("Enter ip address to connect to: ")
- port = input("Enter port to use: ")
- soc.connect((ip, port))
- F_CONNECT_S(soc)
- if not(os.path.isdir("Downloads")):
- os.mkdir("Downloads")
- #Starting measuring time(connection time)
- connection_started = time.time()
- command = [""]
- while not (command[0] == "!LOGOUT" or (command[0] == "SAVE" and command[1] == "!LOGOUT")):
- command = menu()
- if(command[0] == "ECHO"):
- F_ECHO_S(soc, command[1], command[-1])
- elif (command[0] == "GIVEIP"):
- F_GIVEIP_S(soc, command[-1])
- elif (command[0] == "UPTIME"):
- F_UPTIME_S(soc, command[-1])
- elif (command[0] == "WHOAMI"):
- F_WHOAMI_S(soc, command[-1])
- elif (command[0] == "MOVETO"):
- F_MOVETO_S(soc,command[1], command[-1])
- elif (command[0] == "RUN"):
- F_RUN_S(soc,command[1], command[-1])
- elif (command[0] == "PRINTF"):
- F_PRINTF_S(soc,command[1], command[-1])
- elif (command[0] == "GOAWAYF"):
- F_GOAWAYF_S(soc,command[1, command[-1]])
- elif (command[0] == "GOAWAYD"):
- F_GOAWAYD_S(soc,command[1], command[-1])
- elif (command[0] == "MAKEF"):
- F_MAKEF_S(soc,command[1], command[-1])
- elif (command[0] == "MAKED"):
- F_MAKED_S(soc,command[1], command[-1])
- elif (command[0] == "COPYF"):
- F_COPYF_S(soc,command[1],command[2, command[-1]])
- elif (command[0] == "EXEC"):
- F_EXEC_S(soc,command[1], command[-1])
- elif (command[0] == "DL"):
- F_DL_S(soc,command[1], command[-1])
- elif (command[0] == "GET"):
- F_GET_S(soc,command[1], command[-1])
- elif (command[0] == "PING"):
- F_PING_S(soc,command[1], command[-1])
- elif (command[0] == "SCREENSHOT"):
- F_SCREENSHOT_S(soc, command[-1])
- elif(command[0] == "!CONNECT_UPTIME"):
- f_CONNECT_UPTIME_C(command[-1])
- elif (command[0] == "!HELP" and len(command) == 1):
- f_HELP_WITHOUT_ARGUMENT_C(command[-1])
- elif (command[0] == "!HELP" and len(command) == 2):
- f_HELP_WITH_ARGUMENT_C(command[1], command[-1])
- elif(command[0] == "!ABOUT"):
- f_ABOUT_C(command[-1])
- elif(command[0] == "SAVE"):
- if (command[1] == "ECHO"):
- F_ECHO_S(soc, command[2], command[-1])
- elif (command[1] == "GIVEIP"):
- F_GIVEIP_S(soc, command[-1])
- elif (command[1] == "UPTIME"):
- F_UPTIME_S(soc, command[-1])
- elif (command[1] == "WHOAMI"):
- F_WHOAMI_S(soc, command[-1])
- elif (command[1] == "MOVETO"):
- F_MOVETO_S(soc, command[2], command[-1])
- elif (command[1] == "RUN"):
- F_RUN_S(soc, command[2], command[-1])
- elif (command[1] == "PRINTF"):
- F_PRINTF_S(soc, command[2], command[-1])
- elif (command[1] == "GOAWAYF"):
- F_GOAWAYF_S(soc, command[2], command[-1])
- elif (command[1] == "GOAWAYD"):
- F_GOAWAYD_S(soc, command[2], command[-1])
- elif (command[1] == "MAKEF"):
- F_MAKEF_S(soc, command[2], command[-1])
- elif (command[1] == "MAKED"):
- F_MAKED_S(soc, command[2], command[-1])
- elif (command[1] == "COPYF"):
- F_COPYF_S(soc, command[2], command[3], command[-1])
- elif (command[1] == "EXEC"):
- F_EXEC_S(soc, command[2], command[-1])
- elif (command[1] == "DL"):
- F_DL_S(soc, command[2], command[-1])
- elif (command[1] == "GET"):
- F_GET_S(soc, command[2], command[-1])
- elif (command[1] == "PING"):
- F_PING_S(soc, command[2], command[-1])
- elif (command[1] == "SCREENSHOT"):
- F_SCREENSHOT_S(soc, command[-1])
- elif (command[1] == "!CONNECT_UPTIME"):
- f_CONNECT_UPTIME_C(command[-1])
- elif (command[1] == "!HELP" and len(command) == 1):
- f_HELP_WITHOUT_ARGUMENT_C(command[-1])
- elif (command[1] == "!HELP" and len(command) == 2):
- f_HELP_WITH_ARGUMENT_C(command[2], command[-1])
- elif (command[1] == "!ABOUT"):
- f_ABOUT_C(command[-1])
- else:
- soc.send(str(command))
- data = soc.recv(1024)
- print (data)
- soc.close()
- def menu():
- isCommandOkay = False
- while not(isCommandOkay):
- command_list = []
- command = raw_input()
- command_list = command.split(' ')
- if not((command_list[0] in commands)):
- print(command_list[0] + " is not recognized as an internal or external command, operable program or batch file.")
- elif((command_list[0] == "GIVEIP" or command_list[0] == "UPTIME" or command_list[0] == "WHOAMI" or command_list[0] == "!ABOUT" or command_list[0] == "!LOGOUT" or command_list[0] == "SCREENSHOT") and len(command_list) > 1):
- print("Num of arguments is incorrect for \"" + command_list[0] + "\" command!")
- elif((command_list[0] == "ECHO" or command_list[0] == "MOVETO" or command_list[0] == "RUN" or command_list[0] == "PRINTF" or command_list[0] == "GOAWAYF" or command_list[0] == "GOAWAYD" or command_list[0] == "MAKEF" or command_list[0] == "MAKED" or command_list[0] == "EXEC" or command_list[0] == "DL" or command_list[0] == "PING" or command_list[0] == "GET") and not(len(command_list) == 2)):
- print("Num of arguments is incorrect for \"" + command_list[0] + "\" command!")
- elif((command_list[0] == "COPYF") and not(len(command_list) == 3)):
- print("Num of arguments is incorrect for \"" + command_list[0] + "\" command!")
- elif((command_list[0] == "!HELP") and len(command_list) > 2):
- print("Num of arguments is incorrect for \"" + command_list[0] + "\" command!")
- elif(command_list[0] == "SAVE"):
- if not ((command_list[1] in commands)):
- print(command_list[1] + " is not recognized as an internal or external command, operable program or batch file.")
- elif ((command_list[1] == "GIVEIP" or command_list[1] == "UPTIME" or command_list[1] == "WHOAMI" or command_list[1] == "!ABOUT" or command_list[1] == "!LOGOUT" or command_list[1] == "SCREENSHOT") and len(command_list) > 2):
- print("Num of arguments is incorrect for \"" + command_list[1] + "\" command!")
- elif ((command_list[1] == "ECHO" or command_list[1] == "MOVETO" or command_list[1] == "RUN" or command_list[1] == "PRINTF" or command_list[1] == "GOAWAYF" or command_list[1] == "GOAWAYD" or command_list[1] == "MAKEF" or command_list[1] == "MAKED" or command_list[1] == "EXEC" or command_list[1] == "DL" or command_list[1] == "PING" or command_list[1] == "GET") and not (len(command_list) == 3)):
- print("Num of arguments is incorrect for \"" + command_list[1] + "\" command!")
- elif ((command_list[1] == "COPYF") and not (len(command_list) == 4)):
- print("Num of arguments is incorrect for \"" + command_list[1] + "\" command!")
- elif ((command_list[1] == "!HELP") and len(command_list) > 3):
- print("Num of arguments is incorrect for \"" + command_list[1] + "\" command!")
- else:
- isCommandOkay = True
- command_list.append("YES")
- else:
- isCommandOkay = True
- command_list.append("NO")
- return command_list
- def F_CONNECT_S(soc):
- username = raw_input("Enter username: ")
- password = raw_input("Enter password: ")
- messageToSend = r"CONNECT_1\x2\x" + username + r"\x" + password
- soc.send(messageToSend)
- answerFromServer = str(soc.recv(1024)).split(r"\x")[1]
- while(answerFromServer == "no"):
- username = raw_input("Enter username: ")
- password = raw_input("Enter password: ")
- messageToSend = r"CONNECT_1\x2\x" + username + r"\x" + password
- soc.send(messageToSend)
- answerFromServer = str(soc.recv(1024)).split(r"\x")[1]
- def F_ECHO_S(soc, command, isSave):
- dataToSend = r"ECHO_1\x1\x" + command
- soc.send(dataToSend)
- dataReceived = soc.recv(1024)
- splitedDataReceived = str(dataReceived).split(r"\x")
- if(isSave == "YES"):
- nameOfTheFile = "ECHO - " + str(time.strftime("%d.%m.%y")) + " " + str(time.strftime("%H:%M:%S"))
- file = open(r"Downloads:\\" + nameOfTheFile + ".txt", 'w')
- file.write(splitedDataReceived[1])
- else:
- print splitedDataReceived[1]
- def F_GIVEIP_S(soc, isSave):
- dataToSend = r"GIVEIP_1\x0"
- soc.send(dataToSend)
- dataReceived = soc.recv(1024)
- splitedDataReceived = str(dataReceived).split(r"\x")
- if (isSave == "YES"):
- nameOfTheFile = "GIVEIP - " + str(time.strftime("%d.%m.%y")) + " " + str(time.strftime("%H:%M:%S"))
- with open(r"Downloads:\\" + nameOfTheFile + ".txt", 'w') as file:
- file.write(splitedDataReceived[1])
- else:
- print splitedDataReceived[1]
- def F_UPTIME_S(soc, isSave):
- dataToSend = r"UPTIME_1\x0"
- soc.send(dataToSend)
- dataReceived = soc.recv(1024)
- splitedDataReceived = str(dataReceived).split(r"\x")
- if (isSave == "YES"):
- nameOfTheFile = "UPTIME - " + str(time.strftime("%d.%m.%y")) + " " + str(time.strftime("%H:%M:%S"))
- with open(r"Downloads:\\" + nameOfTheFile + ".txt", 'w') as file:
- file.write(splitedDataReceived[1])
- else:
- print splitedDataReceived[1]
- def F_WHOAMI_S(soc, isSave):
- dataToSend = r"WHOAMI_1\x0"
- soc.send(dataToSend)
- dataReceived = soc.recv(1024)
- splitedDataReceived = str(dataReceived).split(r"\x")
- if (isSave == "YES"):
- nameOfTheFile = "WHOAMI - " + str(time.strftime("%d.%m.%y")) + " " + str(time.strftime("%H:%M:%S"))
- with open(r"Downloads:\\" + nameOfTheFile + ".txt", 'w') as file:
- file.write(splitedDataReceived[1])
- else:
- print splitedDataReceived[1]
- def F_MOVETO_S(soc, command, isSave):
- dataToSend = r"MOVETO_1\x1\x" + command
- soc.send(dataToSend)
- dataReceived = soc.recv(1024)
- splitedDataReceived = str(dataReceived).split(r"\x")
- if (isSave == "YES"):
- nameOfTheFile = "MOVETO - " + str(time.strftime("%d.%m.%y")) + " " + str(time.strftime("%H:%M:%S"))
- with open(r"Downloads:\\" + nameOfTheFile + ".txt", 'w') as file:
- file.write(splitedDataReceived[1])
- else:
- print splitedDataReceived[1]
- def F_RUN_S(soc, command, isSave):
- dataToSend = r"RUN_1\x1\x" + command
- soc.send(dataToSend)
- dataReceived = soc.recv(1024)
- splitedDataReceived = str(dataReceived).split(r"\x")
- if (isSave == "YES"):
- nameOfTheFile = "RUN - " + str(time.strftime("%d.%m.%y")) + " " + str(time.strftime("%H:%M:%S"))
- with open(r"Downloads:\\" + nameOfTheFile + ".txt", 'w') as file:
- file.write(splitedDataReceived[1])
- else:
- print splitedDataReceived[1]
- def F_PRINTF_S(soc, command, isSave):
- dataToSend = r"PRINTF_1\x1\x" + command
- soc.send(dataToSend)
- allData = ""
- dataReceived = str(soc.recv(1024))
- allData += dataReceived[9:]
- while not(dataReceived[-6:] == r"\y\y\y"):
- dataReceived = soc.recv(1024)
- allData += dataReceived[9:]
- allData = allData[:-6]
- if (isSave == "YES"):
- nameOfTheFile = "PRINTF - " + str(time.strftime("%d.%m.%y")) + " " + str(time.strftime("%H:%M:%S"))
- with open(r"Downloads:\\" + nameOfTheFile + ".txt", 'w') as file:
- file.write(allData)
- else:
- print allData
- def F_GOAWAYF_S(soc, command, isSave):
- dataToSend = r"GOAWAYF_1\x1\x" + command
- toSend = ""
- while not(toSend == "Y" or toSend == "N"):
- print "Ary you sure you want to delete " + command + " (Y/N)"
- toSend = raw_input()
- if(toSend == "Y"):
- soc.send(dataToSend)
- dataReceived = soc.recv(1024)
- splitedDataReceived = str(dataReceived).split(r"\x")
- if (isSave == "YES"):
- nameOfTheFile = "GOAWAYF - " + str(time.strftime("%d.%m.%y")) + " " + str(time.strftime("%H:%M:%S"))
- with open(r"Downloads:\\" + nameOfTheFile + ".txt", 'w') as file:
- file.write(splitedDataReceived[1])
- else:
- print splitedDataReceived[1]
- def F_GOAWAYD_S(soc, command, isSave):
- dataToSend = r"GOAWAYD_1\x1\x" + command
- toSend = ""
- while not (toSend == "Y" or toSend == "N"):
- print "Ary you sure you want to delete " + command + " (Y/N)"
- toSend = raw_input()
- if (toSend == "Y"):
- soc.send(dataToSend)
- dataReceived = soc.recv(1024)
- splitedDataReceived = str(dataReceived).split(r"\x")
- if (isSave == "YES"):
- nameOfTheFile = "GOAWAYD - " + str(time.strftime("%d.%m.%y")) + " " + str(time.strftime("%H:%M:%S"))
- with open(r"Downloads:\\" + nameOfTheFile + ".txt", 'w') as file:
- file.write(splitedDataReceived[1])
- else:
- print splitedDataReceived[1]
- def F_MAKEF_S(soc, command, isSave):
- dataToSend = r"MAKEF_1\x1\\x" + command
- soc.send(dataToSend)
- serverAnswer = soc.recv(1024)
- splitedDataReceived = str(serverAnswer).split(r"\x")
- if(splitedDataReceived[1] == "exist"):
- toSend = ""
- while not (toSend == "Y" or toSend == "N"):
- print "The file is already existed are you sure you want wo overwrite him " + command + " (Y/N)"
- toSend = raw_input()
- if (toSend == "Y"):
- soc.send(r"MAKEF_1\x1\xyes")
- dataReceived = soc.recv(1024)
- splitedDataReceived = str(dataReceived).split(r"\x")
- if (isSave == "YES"):
- nameOfTheFile = "MAKEF - " + str(time.strftime("%d.%m.%y")) + " " + str(time.strftime("%H:%M:%S"))
- with open(r"Downloads:\\" + nameOfTheFile + ".txt", 'w') as file:
- file.write(splitedDataReceived[1])
- else:
- print splitedDataReceived[1]
- elif (toSend == "N"):
- soc.send(r"MAKEF_1\x1\xno")
- dataReceived = soc.recv(1024)
- splitedDataReceived = str(dataReceived).split(r"\x")
- if (isSave == "YES"):
- nameOfTheFile = "MAKEF - " + str(time.strftime("%d.%m.%y")) + " " + str(time.strftime("%H:%M:%S"))
- with open(r"Downloads:\\" + nameOfTheFile + ".txt", 'w') as file:
- file.write(splitedDataReceived[1])
- else:
- print splitedDataReceived[1]
- else:
- dataReceived = soc.recv(1024)
- splitedDataReceived = str(dataReceived).split(r"\x")
- if (isSave == "YES"):
- nameOfTheFile = "MAKEF - " + str(time.strftime("%d.%m.%y")) + " " + str(time.strftime("%H:%M:%S"))
- with open(r"Downloads:\\" + nameOfTheFile + ".txt", 'w') as file:
- file.write(splitedDataReceived[1])
- else:
- print splitedDataReceived[1]
- def F_MAKED_S(soc, command, isSave):
- dataToSend = r"MAKED_1\x1\x" + command
- soc.send(dataToSend)
- serverAnswer = soc.recv(1024)
- splitedDataReceived = str(serverAnswer).split(r"\x")
- if (splitedDataReceived[1] == "exist"):
- toSend = ""
- while not (toSend == "Y" or toSend == "N"):
- print "The Directory is already existed are you sure you want wo overwrite him " + command + " (Y/N)"
- toSend = raw_input()
- if (toSend == "Y"):
- soc.send(r"MAKED_1\x1\xyes")
- dataReceived = soc.recv(1024)
- splitedDataReceived = str(dataReceived).split(r"\x")
- if (isSave == "YES"):
- nameOfTheFile = "MAKED - " + str(time.strftime("%d.%m.%y")) + " " + str(time.strftime("%H:%M:%S"))
- with open(r"Downloads:\\" + nameOfTheFile + ".txt", 'w') as file:
- file.write(splitedDataReceived[1])
- else:
- print splitedDataReceived[1]
- elif (toSend == "N"):
- soc.send(r"MAKED_1\x1\xno")
- dataReceived = soc.recv(1024)
- splitedDataReceived = str(dataReceived).split(r"\x")
- if (isSave == "YES"):
- nameOfTheFile = "MAKED - " + str(time.strftime("%d.%m.%y")) + " " + str(time.strftime("%H:%M:%S"))
- with open(r"Downloads:\\" + nameOfTheFile + ".txt", 'w') as file:
- file.write(splitedDataReceived[1])
- else:
- print splitedDataReceived[1]
- else:
- dataReceived = soc.recv(1024)
- splitedDataReceived = str(dataReceived).split(r"\x")
- if (isSave == "YES"):
- nameOfTheFile = "MAKED - " + str(time.strftime("%d.%m.%y")) + " " + str(time.strftime("%H:%M:%S"))
- with open(r"Downloads:\\" + nameOfTheFile + ".txt", 'w') as file:
- file.write(splitedDataReceived[1])
- else:
- print splitedDataReceived[1]
- def F_COPYF_S(soc, file1, file2, isSave):
- dataToSend = r"COPYF_1\x2\x" + file1 + r"\x" + file2
- soc.send(dataToSend)
- dataReceived = soc.recv(1024)
- splitedDataReceived = str(dataReceived).split(r"\x")
- if (isSave == "YES"):
- nameOfTheFile = "COPYF - " + str(time.strftime("%d.%m.%y")) + " " + str(time.strftime("%H:%M:%S"))
- with open(r"Downloads:\\" + nameOfTheFile + ".txt", 'w') as file:
- file.write(splitedDataReceived[1])
- else:
- print splitedDataReceived[1]
- def F_EXEC_S(soc, command, isSave):
- dataToSend = r"EXEC_1\x1\x" + command
- soc.send(dataToSend)
- dataReceived = soc.recv(1024)
- splitedDataReceived = str(dataReceived).split(r"\x")
- if (isSave == "YES"):
- nameOfTheFile = "COPYF - " + str(time.strftime("%d.%m.%y")) + " " + str(time.strftime("%H:%M:%S"))
- with open(r"Downloads:\\" + nameOfTheFile + ".txt", 'w') as file:
- file.write(splitedDataReceived[1])
- else:
- print splitedDataReceived[1]
- def F_DL_S(soc, command, isSave):
- dataToSend = r"DL_1\x1\x" + command
- soc.send(dataToSend)
- allData = ""
- dataReceived = str(soc.recv(1024))
- allData += dataReceived[9:]
- while not (dataReceived[-6:] == r"\y\y\y"):
- dataReceived = soc.recv(1024)
- allData += dataReceived[9:]
- allData = allData[:-6]
- with open(r"Downloads:\\" + command.split(r"\\")[-1], 'w') as file:
- file.write(allData)
- def F_PING_S(soc, command, isSave):
- dataToSend = r"PING_1\x1\x" + command
- soc.send(dataToSend)
- dataReceived = soc.recv(1024)
- splitedDataReceived = str(dataReceived).split(r"\x")
- if (isSave == "YES"):
- nameOfTheFile = "PING - " + str(time.strftime("%d.%m.%y")) + " " + str(time.strftime("%H:%M:%S"))
- with open(r"Downloads:\\" + nameOfTheFile + ".txt", 'w') as file:
- file.write(splitedDataReceived[1])
- else:
- print splitedDataReceived[1]
- def F_GET_S(soc, command, isSave):
- dataToSend = r"GET_1\x1\x" + command
- soc.send(dataToSend)
- dataReceived = soc.recv(1024)
- splitedDataReceived = str(dataReceived).split(r"\x")
- if (isSave == "YES"):
- nameOfTheFile = "GET - " + str(time.strftime("%d.%m.%y")) + " " + str(time.strftime("%H:%M:%S"))
- with open(r"Downloads:\\" + nameOfTheFile + ".txt", 'w') as file:
- file.write(splitedDataReceived[1])
- else:
- print splitedDataReceived[1]
- def F_SCREENSHOT_S(soc, isSave):
- dataToSend = r"SCREENSHOT_1\x0"
- nameOfTheScreenshot = str(time.strftime("%d.%m.%y")) + " " + str(time.strftime("%H:%M:%S"))
- soc.send(dataToSend)
- allData = ""
- dataReceived = str(soc.recv(1024))
- allData += dataReceived[9:]
- while not (dataReceived[-6:] == r"\y\y\y"):
- dataReceived = soc.recv(1024)
- allData += dataReceived[9:]
- allData = allData[:-6]
- with open(r"Downloads:\\" + nameOfTheScreenshot + ".png", 'w') as file:
- file.write(allData)
- def f_CONNECT_UPTIME_C(isSave):
- print "The connection is running " + str(time.time() - connection_started) + " seconds."
- def f_ABOUT_C(isSave):
- print "We are Guy Yoffe and Omer Ben Aderet\n"
- print "We are in our last year in \"Magshimim\" And our project is:\n"
- print "Turn our hand-write into a font on the computer, and then to be able use it.\n"
- print "We like sports, being with friends and to programm cool stuff.\n"
- print "This programm contains the full Cyber meaning because\n"
- print "it shows what you can do, and make you thinks what else you can do with cyber\n"
- def f_HELP_WITHOUT_ARGUMENT_C(isSave):
- print "Type commands by your choice: "
- print "ECHO $arg - sends the command to server, gets the same command back and print it($arg is what you want to print)"
- print "GIVEIP - gets the server ip"
- print "UPTIME - gets from the server the amount of time the server is on"
- print "WHOAMI - gets the username that run's the server, and the name of the operation system"
- print "MOVETO $arg - change the current directory($arg is the directory you want to move to)"
- print "RUN $arg - runs the $arg command on the server and gets the output($arg is the command you want operate)"
- print "PRINTF $arg - gets file data($arg the file)"
- print "GOAWAYF $filepath - delete the file in the path($filepath is the path of the file you want to delete)"
- print "GOAWAYD $dirpath - delete the directory in the path($dirpath is the path of the directory you want to delete)"
- print "MAKEF $filepath - creates a file in the path($filepath is the path you want to create the file in it)"
- print "MAKED $dirpath - creates a directory in the path($dirpath is the path you want to create the directory in it)"
- print "COPYF $copied_filepath $deleted_filepath - copies the content of the first file into the second file($copied_filepath is the file you want to copy his content $deleted_filepath is the file you want to move the content into him)"
- print "EXEX $filepath - runs the EXE file in the path on the servers computer($filepath is the path of the EXE file)"
- print "DL $filepath - download the file in the path($filepath is the path of the file you want to download)"
- print "!CONNECT_UPTIME - gets how much time the connection is on"
- print "!HELP - bring's up help with the programm"
- print "!HELP $COMMAND - bring's up help about the certain function($COMMAND is the command you want help with)"
- print "!ABOUT - prints information about the authors of the programm"
- print "!LOGOUT - end's the connection with the server"
- print "PING $dst - operate ping on the server($dst is where the server send's the ping to)"
- print "GET $website - server will send HTTTP packet to the website($website is the website to send the HTTP packet to)"
- print "SCREENSHOT - send's screenshot of the server to the client"
- def f_HELP_WITH_ARGUMENT_C(command, isSave):
- if not (command in commands):
- print command + " Is not a command"
- elif(command == "ECHO"):
- print "ECHO: this command sends a the message contain in in the argument, gets it back from the server and print it.\n"
- print "Example:\n"
- print "[Client~$] ECHO magshimim"
- print "[Server~$] magshimim\n"
- elif(command == "GIVEIP"):
- print "GIVEIP: this command gets the server IPv4 addres.\n"
- print "Example:\n"
- print "[Client~$] GIVEIP"
- print "[Server~$] 192.168.1.1\n"
- elif (command == "UPTIME"):
- print "UPTIME: this command gets the amout of seconds that the server's on.\n"
- print "Example:\n"
- print "[Client~$] UPTIME"
- print "[Server~$] 45.11526\n"
- elif (command == "WHOAMI"):
- print "WHOAMI: this command tells us the current OS logged in username,\nthe underlying OS name and version, and some more basic info.\n"
- print "Example:\n"
- print "[Client~$] WHOAMI"
- print "[Server~$] You are username \"Moshe\", running \"Microsoft Windows 8 Pro\" installed in c:\\Windows.\n"
- elif (command == "MOVETO"):
- print "MOVETO: this command moves the current directory.\n"
- print "Example:\n"
- print "[Client~$] MOVETO C:\Windows"
- print "[Server~$] \n"
- elif (command == "RUN"):
- print "RUN: this command runs the command in the argument on the server's terminal or CMD.\n"
- print "Example:\n"
- print "[Client~$] RUN dir"
- print "[Server~$] 11/12/2016 04:16 AM <DIR> Contacts\n11/19/2016 01:47 PM <DIR> Desktop\n11/12/2016 04:16 AM <DIR> Documents\n11/19/2016 01:10 PM <DIR> Downloads\n"
- elif (command == "PRINTF"):
- print "PRINTF: this command sends a file name to the server and gets and prints his content.\n"
- print "Example:\n"
- print "[Client~$] PRINTF aa.txt"
- print "[Server~$] Hello there!\n"
- elif (command == "GOAWAYF"):
- print "GOAWAYF: this command removes the file that is in the argument.\n"
- print "Example:\n"
- print "[Client~$] GOAWAYF C:\\aa.txt"
- print "[Server~$] \n"
- elif (command == "GOAWAYD"):
- print "GOAWAYD: this command removes the directory that is in the argument.\n"
- print "Example:\n"
- print "[Client~$] GOAWAYF C:\\"
- print "[Server~$] \n"
- elif (command == "MAKEF"):
- print "MAKEF: this command creates a file in the path that is in the argument.\n"
- print "Example:\n"
- print "[Client~$] MAKEF C:\\aaa.txt"
- print "[Server~$] \n"
- elif (command == "MAKED"):
- print "MAKED: this command creates a dirctory in the path that is in the argument.\n"
- print "Example:\n"
- print "[Client~$] MAKEF C:\\a"
- print "[Server~$] \n"
- elif (command == "COPYF"):
- print "COPYF: this command copy's the content of the first file into the second.\n"
- print "Example:\n"
- print "[Client~$] COPYF c:\\aa.txt c:\\aaa.txt"
- print "[Server~$] \n"
- elif (command == "EXEC"):
- print "EXEC: this command runs the EXE file that is given in the argument.\n"
- print "Example:\n"
- print "[Client~$] EXEC C:\\a.exe"
- print "[Server~$] \n"
- elif (command == "DL"):
- print "DL: this command downloads the file that is given in the argument.\n"
- print "Example:\n"
- print "[Client~$] DL C:\\a.bat"
- print "[Server~$] a\nbbb\n"
- elif (command == "!CONNECT_UPTIME"):
- print "!CONNECT_UPTIME: this command prints how many seconds the connection is on.\n"
- print "Example:\n"
- print "[Client~$] !CONNECT_UPTIME"
- print "[Client~$] The connection is running 45.000012 seconds.\n"
- elif (command == "!HELP"):
- print "!HELP: this commands prints help about the programm.\n"
- print "Example:\n"
- print "[Client~$] !HELP"
- print "[Server~$] This programm..............................\n"
- elif (command == "!ABOUT"):
- print "!ABOUT: this command prints little bit of information on the authors of the programm.\n"
- print "Example:\n"
- print "[Client~$] !ABOUT"
- print "[Server~$] Me and Guy...........\n"
- elif (command == "!LOGOUT"):
- print "!LOGOUT: this command ends the connection with the server.\n"
- print "Example:\n"
- print "[Client~$] !LOGOUT"
- print "[Server~$] \n"
- elif (command == "PING"):
- print "PING: this command sends a ping from the server the the destination specified in the argument.\n"
- print "Example:\n"
- print "[Client~$] PING Google.com"
- print "[Server~$] Pinging google.com...........\n"
- elif (command == "GET"):
- print "GET: this command sends HTTP pacet from the server to where specified in the argument.\n"
- print "Example:\n"
- print "[Client~$] GET http://website.com/"
- print "[Server~$] \n"
- elif (command == "SCREENSHOT"):
- print "SCREENSHOT: this command gets screenshot of the server computer.\n"
- print "Example:\n"
- print "[Client~$] SCREENSHOT"
- print "[Server~$] data\n"
- if __name__ == "__main__":
- main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement