Page 11 of 11

Re: Permanent Programming 11

PostPosted: Mon Oct 21, 2013 12:38 pm
by Whiteshadowz
Hey guys.. writing this code in python 3.x... I'm using the requests module.. I've successfully been able to get the source code by opening the url with the right cookie... I've processed all the data and came to an answer... but when I try to post the 'solution' I get an error back saying Invalid refer, I've tried posting the data with the same cookie that allowed me the source code but my program is still considered an Invalid refer... idk where to go from here >:| .. any help would be greatly appreciated :/

Re: Permanent Programming 11

PostPosted: Mon Oct 21, 2013 4:41 pm
by -Ninjex-
Whiteshadowz wrote:Hey guys.. writing this code in python 3.x... I'm using the requests module.. I've successfully been able to get the source code by opening the url with the right cookie... I've processed all the data and came to an answer... but when I try to post the 'solution' I get an error back saying Invalid refer, I've tried posting the data with the same cookie that allowed me the source code but my program is still considered an Invalid refer... idk where to go from here >:| .. any help would be greatly appreciated :/


Not quite sure what you are using to to connect to HTS, but there should be a way to manually set the referer. It might be something like HTTP_REFERER or HTTPReferer or similar.

Re: Permanent Programming 11

PostPosted: Tue Oct 22, 2013 5:12 am
by Amazingred
Whiteshadowz wrote:Hey guys.. writing this code in python 3.x... I'm using the requests module.. I've successfully been able to get the source code by opening the url with the right cookie... I've processed all the data and came to an answer... but when I try to post the 'solution' I get an error back saying Invalid refer, I've tried posting the data with the same cookie that allowed me the source code but my program is still considered an Invalid refer... idk where to go from here >:| .. any help would be greatly appreciated :/


If you're using a urllib2.opener object you'll do this:
Code: Select all
opener.addheaders.append(('Referer','https://www.hackthissite.org/missions/prog/11/index.php'))


for mechanize:
Code: Select all
br.addheaders = [('Referer', 'https://www.hackthissite.org/missions/prog/11/index.php')]


and for your requests library I'm pretty sure its something like this:
Code: Select all
headers = {'Referer': 'https://www.hackthissite.org/missions/prog/11/index.php'}
data={'solution':YOURSOLUTIONSTRINGHERE}
r = requests.post(url, data=data, headers=headers)


that may not be exactly right from my memory but you can figure it from there I think.


I'm pretty sure thats it. I'll check it real quick to be sure.

Re: Permanent Programming 11

PostPosted: Sat May 07, 2016 12:45 am
by _spartax_
Whiteshadowz wrote:Hey guys.. writing this code in python 3.x... I'm using the requests module.. I've successfully been able to get the source code by opening the url with the right cookie... I've processed all the data and came to an answer... but when I try to post the 'solution' I get an error back saying Invalid refer, I've tried posting the data with the same cookie that allowed me the source code but my program is still considered an Invalid refer... idk where to go from here >:| .. any help would be greatly appreciated :/


No Need of http requests bro...i used simple copy paste
And if u do a request each time u get a different generated string

Re: Permanent Programming 11

PostPosted: Sun Oct 02, 2016 11:07 am
by bgbrandongomez
Can I have someone give me the output of these strings? The reason why I want to know is because I am no longer sure if it is my fault that my script only works part of the time with this mission or if the online checker is at fault. I have tried everything including changing the delimiter to see if I get different results or not.

Code: Select all
/* Known problems with operating on Strings
     String                Delimiter                                                                           Answer
     64*77*79*98*66*55*74* 21                                                                           +8:M-"5
     81*68*116*74*117*93*62*111*95*67*65*64*77* 29                                         4'W-X@!RB&$#0
     98'88'57'89'77'90'88'59'91'51'61'56' 16                                                         RH)I=JH+K#-(
     80(90(71(57(38(60(71(78(89(87(71(88(39( 0                                                   PZG9&<GNYWGX'
     80&70&78&63&41&78&43&47&90&81&62&63&77&84&52& 4                       LBJ;%J'+VM:;IP0
  */


A perfectly valid example comes in this script output:

Code: Select all
senor@SenorContento-Laptop:~/.data/NonIDE_Projects/HTS-Projects/Programming/CaesarCipherUndoer$ ./HTS_Programming_11.sh
Parsing...
String: 25-65-15-54-34-62-37-42-60-50-61-29-56-58-
Shift: -19

,T"I5Q8=OEP0KM
Message: "You have already completed this mission"


Thanks!

Re: Permanent Programming 11

PostPosted: Wed Jan 16, 2019 7:46 am
by jasperfirecai2
Talk about a necro...
Potential spoilers here, not sure if you'd count em but you've been warned

Not sure if many people have done this in javascript, but I found that to be a very easy solution. I would definitely recommend using something else to challenge yourself but for javascript there's a really simple premise.


Big upside is that you don't need to bother with requests or cookies, you can just submit the form normally.
Code: Select all
//get the form and input somewhere first
input.value = youranswer;
form.submit();


Something really nice i found out with doing it in javascript is that matching a string to a regex(with global search flag) actually returns an array of the matches.
Code: Select all
// number = "1/2/3/4/5"
// regex checks for 1 or more number
matches = number.match(regex);
// matches = ["1", "2", "3", "4", "5"]


This made the overall challenge nice and simple and really easy to perform within 3 seconds on the page. just copy+paste into console.



"Hardest" part in javascript was obtiaining the string, which basically required a hardcoded input location (lotsa spaghetti).
Code: Select all
let content = document.getElementsByClassName("sitebuffer")[0].children[2].children[0].children[3].children[1].innerHTML;
// the position is absolute but what i need has no name, no id and no unique tagname so yay spaghetti

Re: Permanent Programming 11

PostPosted: Mon Apr 01, 2019 3:42 am
by samikasothe
Excellent thread! Thanks for sharing such an excellent piece of information. It was helpful for me. Keep up!