Jump to content

Python Help!

X1XNobleX1X

Hello, 

I'm learning how to program with Python, using an online tutorial. 

This is the question, I don't know what I would use, I'm assuming the "phase.find" string function. 

 

Write a program that pretends to be a Heartbleed affected server. First, read in the attacker's requested word and length, e.g. POTATO and 12. Then, read in the pretend server memory and return the hacked data according to the request.

Your program should find the first instance of the request word (e.g. POTATO) in the memory, and then print out length (e.g. 12) characters from where the word started (so the output will always start with the request word). Here's our example:

 
 
Request: POTATO
Length: 12
Memory: User wants 12 letters: POTATO. User sets master password to "CoHoBaSt".
POTATO. User
 

Here is another example:

 
 
 
 
 
 
Request: SQL
Length: 50
Memory: Sophia requests the "SQL" page. Rebecca changes password to ACqmRsf. Jana (administrator) changes logout time to 5000s.
SQL" page. Rebecca changes password to ACqmRsf. Ja
 

And a third example:

 
 
 
 
 
 
Request: password
Length: 100
Memory: Andrian changes password to "4FGbJd7hf". Katrina requests page on starfish. Sam requests page on cake. Jehan changes password to "2wjIQaMc". Ben uploads "selfie.jpg" data: a3b8893efac38924c932jcd32534ac67348fe88d8c8a923676j234
password to "4FGbJd7hf". Katrina requests page on starfish. Sam requests page on cake. Jehan changes

|CPU: Intel 5960X|MOBO:Rampage V Extreme|GPU:EVGA 980Ti SC 2 - Way SLI|RAM:G-Skill 32GB|CASE:900D|PSU:CorsairAX1200i|DISPLAY :Dell U2412M X3|SSD Intel 750 400GB, 2X Samsung 850 Pro|

Peripherals : | MOUSE : Logitech G602 | KEYBOARD: K70 RGB (Cherry MX Brown) | NAS: Synology DS1515+  - WD RED 3TB X 5|ROUTER: AC68U

Sound : | HEADPHONES: Sennheiser HD800 SPEAKERS: B&W CM9 (Front floorstanding) ,  B&W CM Center 2 (Centre) | AV RECEIVER : Denon 3806 | MY X99 BUILD LOG!

 

Link to comment
Share on other sites

Link to post
Share on other sites

The solution could be matching a regular expression

https://docs.python.org/2/library/re.html

i am not a native speaker of the english language

[spoiler=My Rig: ]CPU: i7-3770k@Stock | Ram: 3x4GB@1600Mhz | Graka: 660TI@Stock | Storage: 250GB 840Evo, 1x1TB,2x2TB,2x640GB,1x500GB (JBOD) + NAS: DLINK DNS-320 2x3TB Raid1

 
Link to comment
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×