failed to execute scapy commands from remote server

Iranna Mathapati iranna.gani28 at gmail.com
Thu Aug 9 08:11:01 EDT 2018


Hi Team,

I have to ssh a remote server and execute scapy commands there.


but its able to execute all linux commands from remote server handle


I use pexpect and hitting issue.



1.       SSH to remote shell via pexpect  from current server

parser_ip_add='192.168.1.83'



child_remote = pexpect.spawn('/usr/bin/ssh',['AST@
{0}'.format(parser_ip_add)])

ssh_newkey = 'Are you sure you want to continue connecting'



i=child_remote.expect([pexpect.TIMEOUT, ssh_newkey, 'password:'])



if i==2:

    child_remote.sendline('XXXXX') <<< password



child_remote.sendline('sudo su')

child_remote.expect('password for AST: ')

child_remote.sendline('XXXXX')  <<<<<password





2.       When I try to execute scapy cmds in remote server I get the below
error

>>> child_remote.sendline=sendp(arp3,iface='enp6s0f0',count=100)

Traceback (most recent call last):

  File "<stdin>", line 1, in <module>

  File "/usr/local/lib/python2.7/site-packages/scapy/sendrecv.py", line
256, in sendp

    __gen_send(conf.L2socket(iface=iface, *args, **kargs), x, inter=inter,
loop=loop, count=count, verbose=verbose, realtime=realtime)

  File "/usr/local/lib/python2.7/site-packages/scapy/arch/linux.py", line
425, in __init__

    self.ins.bind((iface, type))

  File "/usr/local/lib/python2.7/socket.py", line 224, in meth

    return getattr(self._sock,name)(*args)

socket.error: [Errno 19] No such device

>>> child_remote.sendline(sendp(arp3,iface='enp6s0f0',count=100))

KeyboardInterrupt



More information about the Python-list mailing list