to login in ssh server at hostname and port as user
ssh <user>@<hostname> -p <port>
to work with dashed files use ‘<-’ instead of ’-’
cat <-
to use , use escape sequence <space>
cat spaces\ in\ this\ filename
3-4. to check hidden files in directory
ls -a
check file type of all files , ascii files will be human readable .
Cd inhere
File inhere/\*
File dir/* prints all file types in dir directory
to find a file of size x bytes in y dir (c for bytes)
find y -size xc
here,
find / -size 1033c
find -user <username> -group <groupname> -size 33c
use grep to search within files
grep -F <pattern> <filename>
-F for fixed string pattern
use diff by piping two stdout as stdin
diff --normal <(sort -R data.txt | uniq --all-seperated -) <(sort -R data.txt | uniq -u -)
can only use uniq -u with sorted files
use grep to match output with at least == pattern after piping stdout from strings function ,strings will print all human readable characters
strings data.txt | grep == -
decode the given base64 encoded data
base64 -d data.txt
use translate -t giving range as array set taking input from data.txt file , in default case it translates characters from set1 to set 2
tr -t [A-Za-z] [N-ZA-Mn-za-m] < data.txt
first, retrieve the compressed file from hexdump file,
then decompress repeatedly using bzip2, gzip, tar
for reverse hexdump,
xxd -r data\_copy.txt > data0.txt
data0.txt is a compressed file of gzip, bzip2, tar which is checked by file command ,then rename file using mv to add appropriate suffix like gz, bz2
gzip -d data0.txt.gz
bzip2 -d data0.txt.bz2
since private key is already generated and given as file, to use private key for ssh server use -i tag
ssh -i <filename> <user>@<hostname> -p <port>
path for password is given in prev level, so we have to just transfer data between two ports on the localhost, using nc we check for the status of the ports 2220 (source) and 30000 (destination)
nc -l localhost 2220 output: already in use
nc -l localhost 30000 output: already in use
to send password string to port 30000 of localhost
(use <<<’’ for string and < for file )
nc localhost 30000 <<< ‘<password for level14>’