Hints and Tips for PythonChallenge level 4

This is a page of hints for the Pythonchallenge.com level 4 challenge

It does not contain the answer so you can use as many hints as you want but still have to put everything together yourself to complete it

Note: A lot of these challenges have multiple different ways of solving them, the hints here might not match to what you have found already.

Expand for hint 1

Do not try to manually follow the numbers, there are 100’s

Expand for hint 2

Does Python have a library for reading the content of webpages?

Expand for hint 3

Try Beautiful soup

Expand for hint 4

Can you generate a new url based on what Beautiful soup finds?

Expand for hint 5

Not all the numbers are the same length

Expand for hint 6

The last page doesn’t have anymore numbers

Advertisement

Hints and Tips for PythonChallenge level 3

This is a page of hints for the Pythonchallenge.com level 3 challenge

It does not contain the answer so you can use as many hints as you want but still have to put everything together yourself to complete it

Note: A lot of these challenges have multiple different ways of solving them, the hints here might not match to what you have found already.

Expand for hint 1

Anything interesting in the source code?

Expand for hint 2

3 big bodyguards? what could that mean?

Expand for hint 3

Can you open the text in python like in challenge 2?

Expand for hint 4

Can Python search for patterns in text?

Expand for hint 5

Maybe Regex can help?

Expand for hint 6

Exactly 3 bodyguards, not more.

Hints and Tips for PythonChallenge level 2

This is a page of hints for the Pythonchallenge.com level 2 challenge

It does not contain the answer so you can use as many hints as you want but still have to put everything together yourself to complete it

Note: A lot of these challenges have multiple different ways of solving them, the hints here might not match to what you have found already.

Expand for hint 1

Are all the clues visible on the page?

Expand for hint 2

Maybe there’s something hidden in the source code?

Expand for hint 3

Are all the characters the same? do some of them repeat? are any unique?

Expand for hint 4

Can Python open text files and read them?

Expand for hint 5

Can you automatically remove duplicate characters?

Expand for hint 6

Have you come across the replace method before?

Hints and Tips for PythonChallenge level 1

This is a page of hints for the Pythonchallenge.com level 1 challenge

It does not contain the answer so you can use as many hints as you want but still have to put everything together yourself to complete it

Note: A lot of these challenges have multiple different ways of solving them, the hints here might not match to what you have found already.

<details><summary>Expand for hint 1</summary>If A=B, and B=C, what does C=?

</details><details><summary>Expand for hint 2</summary>if A=C, and B=D, what does C=?

</details><details><summary>Expand for hint 3</summary>Did Caeser ever invent a cipher?

</details><details><summary>Expand for hint 4</summary>Any interesting words in the page title?

</details><details><summary>Expand for hint 5</summary>What can you do with the maketrans() python method?

</details><details><summary>Expand for hint 6</summary>Once you have translated the text, try editing the URL again

Hints and Tips for PythonChallenge level 0

This is a page of hints for the Pythonchallenge.com level 0 challenge

It does not contain the answer so you can use as many hints as you want but still have to put everything together yourself to complete it

Note: A lot of these challenges have multiple different ways of solving them, the hints here might not match to what you have found already.

Expand for hint 1

Numbering in python starts at 0 and goes up.

Expand for hint 2

The URL bar is normally shown at the top of your browser, can you manually edit it?

Expand for hint 3

The aim is to get to page for the next level.

Expand for hint 4

Python has many mathematical operators.

Expand for hint 5

a single * is for multiplication, a double ** is for something else.

Expand for hint 6

If you think your maths has worked, try editing the URL once again

Installing netfilterqueue in Kali

I had some trouble recently trying to install the python library netfilterqueue onto my Kali box as the usual pip or pip3 commands didn’t seem to work.

both python 2 and python 3 brought back a similiar error:

1

Command “/usr/bin/python3 -u -c “import setuptools, tokenize;__file__=’/tmp/pip-install-8l8q2wql/netfilterqueue/setup.py’;f=getattr(tokenize, ‘open’, open)(__file__);code=f.read().replace(‘\r\n’, ‘\n’);f.close();exec(compile(code, __file__, ‘exec’))” install –record /tmp/pip-record-sk6qu_jn/install-record.txt –single-version-externally-managed –compile” failed with error code 1 in /tmp/pip-install-8l8q2wql/netfilterqueue/

One method to get around it is to try and install it on a different flavour of Linux, but after a bit of trial and error I found that you can get it onto Kali using:

sudo apt-get install python-netfilterqueue

2

This gets it onto your machine for python 2:

3.png

 

port scanner python script

Python port scanner – raw code with explanation

If you ever find yourself without access to Nmap here is some quick python code for testing the up/down status of 1000 TCP ports on a target host. The code is explained at the bottom:

#!/usr/bin/python

import socket
from termcolor import colored

sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
socket.setdefaulttimeout(1)

host = input(“Enter the target host: “)

def portscanner(port):
if sock.connect_ex((host,port)):
print(colored(“Port %d is closed” % (port), ‘red’))
else:
print(colored(“port %d is open” % (port), ‘green’))

for port in range(1,1000):
portscanner(port)

Explanation:

import socket
from termcolor import colored

These 2 libraries are responsible for creating the connection to the target and for allowing us to add colour to the output

sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
socket.setdefaulttimeout(1)

Sets the connection to use IP4 and sets the timeout to 1 second so you don’t get stuck waiting for connection requests to time out

host = input(“Enter the target host: “)

This is the prompt which you see when you run the code, it adds the input to the ‘host’ variable

def portscanner(port):
if sock.connect_ex((host,port)):
print(colored(“Port %d is closed” % (port), ‘red’))
else:
print(colored(“port %d is open” % (port), ‘green’))

Here is the main function. Instead of testing for a successful connection it looks for a failure, if so it reports that the port is closed. If anything else comes back it assumes the port is open and reports that.

for port in range(1,1000):

Sets the script to scan ports 1- 1000, you can change this to specific numbers or increase the range up to 65535