Welcome to HBH! If you have tried to register and didn't get a verification email, please using the following link to resend the verification email.

A little help with Timed 7


ghost's Avatar
0 0

So I've been working on Timed 7 using PHP + GD Library, and I'm pretty sure the actual code works correctly, just not how I'm sending it to HBH. I decoded a barcode by hand and it matches up to the code my program outputs.

I'm a little confused as to what it means by a 'valid' barcode. If it means using the formula to make sure everything matches up to the check digit, then that's what I'm doing. I'm also confused as to what to set 'validity' equal to. Is it a true/false variable, or should I actually set it to 'valid' or 'invalid'?

I think my biggest problem though, is that the barcode I decode is different from the one that HBH spits out when I request it, because I do all the decoding before I connect to HBH with cURL. So if anyone can help me how to figure out how to get the barcode HBH spits out, rather than a random one, that would be great.

If anyone wants to help me more, I can PM them my code to see if there's something specific I'm doing wrong.

And I hope this isn't a spoiler, but this is the code my program outputted: 684093883049

For this barcode:


ghost's Avatar
0 0

Same problem here, not a clue how it wants me to submit the answer. I'll update you if I work this out.

I think you get a barcode then submit it, even though to spits out a new barcode. but I don't know what the post fields should be.

got it, as an example:

barcode=1978928928&validity=valid


ghost's Avatar
0 0

Yeah your post id's seem right, but the script generates random barcodes I believe… you need to request the page and use that Image before posting back. Otherwise you would have to just be damn lucky to send back any random barcode image.


elmiguel's Avatar
Member
2,795 1

barcode=1978928928&validity=valid

These are correct, just make sure you send a page request to the image itself then save it your HDD. After that, its pretty simple.

Good Luck.


synstealth's Avatar
PHP WARRIOR
2,490 1

ive been working on this for a while now .. I cant seem to pull images generated by barcode.php and I cURL from it and it gives me garbage. how do I get around this? what am I missing out ? hope this is not a spoiler..

curl_setopt($ch, CURLOPT_BINARYTRANSFER, true);
curl_setopt($ch, CURLOPT_URL, 'http://www.hellboundhackers.org/challenges/timed/timed7/barcode.php');

result:

‰PNG  ��� IHDR���Ò���d���ÉÄüi���PLTEÿÿÿ���UÂÓ~���tRNS�@æØf���;IDATH‰c؁±ñŸŸ™æ±ùlü™ŸßàρÃçy ŒGåFåFåFåFåFåFåF冢ÜÈ�hҍˆ¸;D2����IEND®B`‚


stranac's Avatar
Member
0 0

After thinking about it for a while, I decided not to make a new thread.

I cant seem to find out how to download the generated image. Any help would be nice. Thanks. (Using PHP)


ghost's Avatar
0 0

stranac wrote: I cant seem to find out how to download the generated image. Any help would be nice. Thanks. (Using PHP)

cURL.


stranac's Avatar
Member
0 0

Compromise wrote: [quote]stranac wrote: I cant seem to find out how to download the generated image. Any help would be nice. Thanks. (Using PHP)

cURL.[/quote]

OK, but if I get the page trough cURL, I can just see the url. Or are you saying I should access the image URL directly? I guess I should try that.


GTADarkDude's Avatar
Member
0 0

It is possible to go for CURLOPT_BINARYTRANSFER, but personally I preferred CURLOPT_FILE to save the retrieved image as a local file. Then use the GD library to determine the barcode and then check if it's valid. Finally, use cURL again to send the answer back to HBH.


ghost's Avatar
0 0

Hope this isn't a spoiler but it's not the part being tested by this challenge anyways. This is what you do.

  1. download png file from http://www.hellboundhackers.org/challenges/timed/timed7/barcode.php
  2. decode barcode. test validity
  3. POST barcode=NUMBER&validity=(valid|invalid) to http://www.hellboundhackers.org/challenges/timed/timed7/index.php

All within the specified time.

As you can see from my profile page I haven't done it (keep getting time outs) but I think this is correct.

Edited as per GTADarkDude's post.


ghost's Avatar
0 0

Just got this done and the code it horrible…


stranac's Avatar
Member
0 0

Does anyone know what the time limit is on this one?

I was kinda hoping my home connection would be good enough, but it seems I'm gonna have to do it when I get back to college.


GTADarkDude's Avatar
Member
0 0

I'm pretty sure it's around 2 seconds. Tried a couple of times, and it works in 1.9767189025879 seconds, but it says I ran out of time when it lasts 2.0428001880646 seconds.


ghost's Avatar
0 0

stranac wrote: Does anyone know what the time limit is on this one?

I was kinda hoping my home connection would be good enough, but it seems I'm gonna have to do it when I get back to college.

unless it's very low you should have time, cause the actual computation doesn't take long at all nor does the post.


synstealth's Avatar
PHP WARRIOR
2,490 1

is there a script where I can look into decoding / reading barcodes from an image?


synstealth's Avatar
PHP WARRIOR
2,490 1

ive done that part. I figured how to pull image by colors..

now Im working on how to convert the output to measure the numbers in binary .. I am wanting to say something here that may be a big spoiler - PM me so I can PM you on my results of what im trying to do.


b4ckd0or's Avatar
Member
0 0

I can easily save the barcode local, look how thick a line is(in pixels), but i dont know how i now can decode the barcode. I already Googled, but didn't find any helpfull answer. Can somebody give me a link or something to help me out?

Edit:

My Script already outputs his: 10101011110100011010001101110110011001011011101010111010010011101001000100001011101001101100101

1 = black px 0 = white px

if that spoils to mutch ill edit it. Then you could answer me per PM :)


b4ckd0or's Avatar
Member
0 0

lol thanks thats so freaking simpel i never thought about it xD I think ill get it now :)