Page 7 of 7

Re: Programming 12

PostPosted: Fri Jun 03, 2011 10:03 pm
by gh0stelement
fashizzlepop wrote:Make sure you have your script logged in, open the challenge page, grab the challenge, solve it, and submit it. :)


I have been doing that: I am using httplib and HTTPConnection (python). My problem is that when I make my get request I get one string and then make my post request the html code has another string and the website is expecting the second string to be the one I am using. Im not sure how to make it so both requests use the same page.

Re: Programming 12

PostPosted: Sat Jun 04, 2011 11:27 am
by adamcaa
Only a guess, but it sounds to me like you're making a second request to the server in between getting the text that needs to be processed and posting the answer to the server. I'm curious to see what it turns out to be.

I've done programming missions 1,2,and 11 in perl. I want to learn python to so i'm going to do this mission in python. If I come accross something pertaining to this solution I'll try and help out.

[update] Alright! I've finished this level in Python!

Re: Programming 12

PostPosted: Sat Jun 04, 2011 1:16 pm
by fashizzlepop
Edit: sorry, not sure what's wrong yet. Unless you are accidentally accessing the mission page twice.

Re: Programming 12

PostPosted: Sat Jun 04, 2011 4:49 pm
by adamcaa
gh0stelement wrote:I have been doing that: I am using httplib and HTTPConnection (python). My problem is that when I make my get request I get one string and then make my post request the html code has another string and the website is expecting the second string to be the one I am using. Im not sure how to make it so both requests use the same page.


OK, I've learned a little Python now. I coded a script that connects,logs in, gets to the missions page retrieves the text to be processed(although I haven't written the method to process it yet), and then it submits 'test' results.

Taking a look through Wireshark everything is working correctly. if you haven't fired up Wireshark I highly recommend doing so. It will shine some light on the interaction. Is your script submitting do you get the wrong answer page?

[update] I've finished this level. If you want me to take a look at your script I can.

Re: Programming 12

PostPosted: Wed May 09, 2012 7:59 pm
by zyewni
I'm sharing this because although I feel like an idiot, my stupid mistake is very mildly amusing and more importantly, maybe I can spare someone a headache in the future if they happen to be making my mistake.

I did this one with a php script, same as I did the other programming missions I've done, that logs itself into the site, gets the source for the challenge, then posts the responses back to the site - ran in to two problems though.

First, the additional requirement this time of posting submit as well as the solution held me back for a full half hour - I had to check the forums to find this out, which I try to do only if I'm absolutely stumped.

Secondly, and more stupidly, my program kept coming back with the wrong product at the end. What I did for the program was to parse the source, duplicate the string, loop for the number of characters in the string, deal with the first character accordingly, then chop off the first character before the string repeats.

After manually verifying (several times) that it was sorting primes and composites correctly, I decided to see how many times the loop was iterating - and it was always half the length of the original string.

It turns out I had set the loop to iterate as many times as the number of characters in the string I was chopping up instead of the original. Therefore, when the two equalized (halfway point), it quit looping. D'OH! :oops: Changed it to count the characters in the ORIGINAL, UNMODIFIED string, and it worked the first time I ran it.

tl;dr: If you're using string length as the number of times your loop should loop, make sure it's not a string that you're gradually shortening, especially if you've already duplicated the string for safekeeping.

Also, huge thanks to Defience for posting examples to test against - I wonder how long it would have taken me to catch my mistake without that.

Re: Programming 12

PostPosted: Thu Jun 21, 2012 11:45 pm
by wan26
Libcurl saves the day again, except i missed out the following important detail,

Code: Select all
string thirdvalue = "&submitbutton=Submit";


While my code has more lines than I presumed it would have been, it is very quick on execution. Much more satisfying as well, std::accumulate comes in handy btw :]

Re: Programming 12

PostPosted: Thu May 22, 2014 6:59 pm
by byotic
these is the script I wrote (for you C# lovers):
Edited to remove blatant spoiler
and I get a seemingly legit string. But somehow i'm wrong... Can you give me a lead on what am I doing wrong?

Re: Programming 12

PostPosted: Fri May 29, 2015 10:23 pm
by tayfie
byotic:

Your logic is correct. I would suggest urlencoding the answer. That was my problem before I solved it.

Re: Programming 12

PostPosted: Fri May 06, 2016 9:47 am
by _spartax_
Did it in python..just automated copy-paste

Re: Programming 12

PostPosted: Sun Oct 02, 2016 10:23 am
by bgbrandongomez
For me, when I did this mission just a few minutes ago, I managed to get the congratulations message, but when I compare my strings to the others posted on this forum, I get a different set of prime numbers than what others get. The script seem to always succeed for me so far. The output below is:

Code: Select all
senor@SenorContento-Laptop:~/Desktop/HTS/Programming/StringMan$ ./HTS_Programming_12.sh
Parsing...
String: f1?9dk#d58e$w1qstgpks2brnjq86p1w$vxyl4nzdih#u9y2of#wlpj$b?b@x$8csrs?lzanh?c@nztst9mk$qq3x12@vdaf?ud$s?cs$e3#?3uw5oqgkcyv44ix32j78rwmnejs4m@cs#yaqi@$a101logfcams0?q3jq?y2@y2v5c#wim0fukq4sk#g1l3w#dhuwcz5v#ha8?45c3pzlu$s7r41a0cm?hht26jmxfmnlq4xop5t@zpnzn27nednaklr1?txqpdscgo59k80a?1xj@orobjq7j2ajyk9wxt#rw@eke?5wq@9h##rdsa81$4zhgjq74m2mi97kzgg070z11hjlxs3l9jjadd$qxcjmkez86so947b2rlf0nus5ncgq5y$hm1vjs4usm1nch9d2xx3ramlmzyvnn64?$7b?n$vz0fks00?blwhzugcn7t4@yubeonc?exlkll@8o8n0vdj290ot?ty4?@mfwenbe32iur0$13itoet9?xhik0@d8jf@a5v1@wzuw@z1pdhchn$y8?gcdelgc8e88lo9xn2j0ro?7adrztyexrbhci?el#riov0c$zz4q?r2emueclbo?0drfzh1nalzs2zn?q308748yi?wph?09l

Prime (52): 5+2+2+3+2+3+3+5+3+2+7+3+2+2+5+3+5+5+3+7+2+5+2+7+5+7+2+5+7+2+7+7+3+7+2+5+5+2+3+7+7+2+3+2+3+5+2+7+2+2+3+7
Composite (52): 9+8+8+6+4+9+8+9+4+4+8+4+4+8+4+4+6+4+9+8+9+9+8+4+4+9+9+8+6+9+4+4+9+6+4+4+8+8+9+4+9+8+8+8+8+8+9+4+8+4+8+9
Prime: 209 | Composite: 354 | Total (Mult): 73986
Length: 0123456789012345678901234
String: g@el$ef%xrtuhqltcsokrqx%w73986
"g@el$ef%xrtuhqltcsokrqx%w73986"
Message: "You have already completed this mission"


I got the below output when manually testing a string from the forum:

Code: Select all
senor@SenorContento-Laptop:~/Desktop/HTS/Programming/StringMan$ java StringMan "u2vmsbz4luw#wxg@i@0ixvjhuraehe#ondzh9arn?lg8aj2@j6l9?dmur4wkajfppk3gvgv@akyymsfra?q@m5s@@1jkd
> 821tn8ty@exix$5?i8ey0maf8sqx2i0zr?kftf@?ibe4tbf#wnoi?slhaevgr2?@3n08qdgh93e2#m8zw5sgco00azk3c@35i4tzi@3kse
> yek3ux5cb13an8ousme4vsn4c8qu?ovk8483ts$tz#u7cdhrooh?$lg9eyollnajmoc#ap3$4$u8w4u7qvxpww431rh5vkhnga8rj@v@
> 0@vi8gjkakknhj7?3q@xwbd5e9ocjpy4yc50uqbn9celfdz5b9@n8evssx3na95wic5nmy6kyl9u3u1b6@z0izexr13i0v0rh3ed@d@
> o#ce@s0um1rrt3oy$h0admnvp9s0#qtn$7k2ew7mx5?6@yujw#g8urtq3886u912fxdc3oa??a3ce3vuxm$y93zgr16ff2tiwoub?l?
> igry8#l2aj3ja0$k3?nfpbc$to#oggzsf0@2?jjmws$498rpnj?uy05lj7eyczxpagc5xit?c1cwv3i$?suxi#zmyabzct3vfnwaae0@7kyh#
> gm?t3ze188i2put0fd$17qvwntc{mvx$xyhAjAjywkivsbf"
Parsing...
String: u2vmsbz4luw#wxg@i@0ixvjhuraehe#ondzh9arn?lg8aj2@j6l9?dmur4wkajfppk3gvgv@akyymsfra?q@m5s@@1jkd
821tn8ty@exix?i8ey0maf8sqx2i0zr?kftf@?ibe4tbf#wnoi?slhaevgr2?@3n08qdgh93e2#m8zw5sgco00azk3c@35i4tzi@3kse
yek3ux5cb13an8ousme4vsn4c8qu?ovk8483ts#u7cdhrooh?#ap3@v@
0@vi8gjkakknhj7?3q@xwbd5e9ocjpy4yc50uqbn9celfdz5b9@n8evssx3na95wic5nmy6kyl9u3u1b6@z0izexr13i0v0rh3ed@d@
o#ce@s0um1rrt3oy#qtnk2ew7mx5?6@yujw#g8urtq3886u912fxdc3oa??a3ce3vuxm?l?
igry8#l2aj3ja0?nfpbc#oggzsf0@2?jjmws98rpnj?uy05lj7eyczxpagc5xit?c1cwv3i0suxi#zmyabzct3vfnwaae0@7kyh#
gm?t3ze188i2put0fd7qvwntc{mvx

Prime (53): 2+2+3+5+2+2+2+3+3+2+5+3+3+5+3+3+5+3+3+7+3+7+3+5+5+5+3+5+5+3+3+3+3+2+7+5+3+2+3+3+3+2+3+2+5+7+5+3+3+7+3+2+7
Composite (43): 4+9+8+6+9+4+8+8+8+8+4+8+9+8+4+8+4+4+8+8+4+8+8+9+4+9+9+8+9+6+9+6+6+8+8+8+6+9+8+9+8+8+8
Prime: 196 | Composite: 312 | Total (Mult): 61152
Length: 0123456789012345678901234
String: vwntc{mvx$xyhAjAjywkivsbf61152


The forum post says I should get vwntc{mvx$xyhAjAjywkivsbf87087 as my string.

Basically, I want to know if the requirements were changed since the others posted this, or if something else weird is going on. Thanks!

Please remove these results if they are too spoilery! Thanks!