First I wanna say I am new to python I mostly use to do programming in java so forgive me if the answer is obvious but I am having the error (_socketobject' object has no attribute 'bing') when I run my script but I cant see anything wrong with it....
import socket
import sys
import threading
import paramiko
host_key = paramiko.RSAKey
(filename='/home/moonman/Desktop/test_rsa.key')
class Server (paramiko.ServerInterface):
def __init__(self):
self.event = threading.Event()
def check_channel_request(self, kind, chanid):
if kind == 'session':
return paramiko.OPEN_SUCCEEDED
return paramiko.OPEN_FAILED_ADMINISTRATIVELY_PROHIBITED
def check_auth_password(self, username, password):
if (username == 'moonman') and (password == 'lover23567'):
return paramiko.AUTH_SUCCESSFUL
return paramiko.AUTH_FAILED
try:
global sock
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sock.bing(('192.168.1.13' , 22))
sock.listen(1)
print '[+] Listening for Connection ...'
except Exception, e:
print '[-] Cant start listening ): ' + str(e)
try:
client, addr = sock.accept()
print '[+] Just got a reverse connection from ' + str(addr)
t = paramiko.Transport(client)
t.load_server_moduli()
t.add_server_key(host_key)
server = Server()
t.start_server(server=server)
global chan
chan = t.accept(1)
print chan.recv(1024)
chan.send("Connection Understood! Loud and clear!!")
except:
print "[-] Connection just died"
pass
Socket object has no attribute as bing. I guess you meant sock.bind which binds the socket to the address you defined. Try this:
sock.bind(('192.168.1.13' , 22))
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.