Jump to content

Recommended Posts

Let's see if I can adequately describe what I need help with here. I'm trying to shift the lines of a txt file do meet my required output.

I'm trying to create a list of numbers to brute force a lock (that I own). This lock will ignore everything leading up to the correct pin.  for example, if the pin is 1234 and enter 46541198751234  and it will unlock.  In my research, I have discovered the De Bruijn sequence (https://en.wikipedia.org/wiki/De_Bruijn_sequence) which will allow me to quickly go through all possible PINs in a very efficient manner without having to enter each option individually. The problem is that as a weak brute force protection they lock allows for almost 40 keys to be pressed before it times out for 30 seconds. 

I have split the De Bruijn sequence down into 40 character lines, but to ensure that I do not miss any of the 4 digit pins I need to use the last 3 of the previous line at the start of the next. This also means that I have to cut 3 from the end of the line to stay within the 40 character limit.  

For example, if my file has the following list of numbers...

00000000000000000000
11111111111111111111
22222222222222222222
33333333333333333333

... I would need to re-arrange them as follows

00000000000000000000       <- first line is untouched, but the last 3 numbers are used at the start of the next line
00011111111111111111       <- the last 3 of the previous line are added to the start of this one, but to make room 3 character are automatically bumped to the next line
11111122222222222222      <- and the process would need to continue until the end of the 100 or so lines
11111111122222222222
11111111111122222222
11111111111111122222
11111111111111111122
12222222222222222222
22223333333333333333

The also means that new lines would be added to the end of the list to accommodate the continually growing shift.

Any clues on how to accomplish this?

Link to post
Share on other sites

What are the tools you plan on doing this with?  Does it need to be a script or would a programming language work?  Do you know the length of the pin (in your example you gave it's 4)?  If the pin is shorter then you only need to work about changing the end by that much (if I'm not mistaken).  What you say about shifting by 3 and the next line doesn't make any sense without reasons for this handicap.

For normal brute force character sequences their's a tool called crunch.  For what you're asking for it's not that hard to write a little program.

Link to post
Share on other sites

Here's how I'd tackle it. The key part is not to break it down to 40 character lines, but instead to take 40 character length sub-strings from the sequence, where each sub-string starts 37 characters on from the start of the previous sub-string.

#!/usr/bin/perl

my $sequence = "1234567890123456789012345678901234567890123456789012345678901234567890";
my $length = length $sequence;

for ( my $i = 0; $i < $length; $i += 37 ) {
    print substr($sequence, $i, 40) . "\n";
}
Link to post
Share on other sites
On 12/8/2017 at 2:01 AM, 6ftdan said:

What are the tools you plan on doing this with?  Does it need to be a script or would a programming language work?  Do you know the length of the pin (in your example you gave it's 4)?  If the pin is shorter then you only need to work about changing the end by that much (if I'm not mistaken).  What you say about shifting by 3 and the next line doesn't make any sense without reasons for this handicap.

For normal brute force character sequences their's a tool called crunch.  For what you're asking for it's not that hard to write a little program.

I'm trying to brute force a physical lock that only looks at the last numbers pressed, hence using the sequences. But it times out after 40 keys are pressed. Since I will been manually entering the codes I need/want it to be as efficient as possible

Link to post
Share on other sites
On 12/8/2017 at 12:06 PM, Jason Cooper said:

Here's how I'd tackle it. The key part is not to break it down to 40 character lines, but instead to take 40 character length sub-strings from the sequence, where each sub-string starts 37 characters on from the start of the previous sub-string.


#!/usr/bin/perl

my $sequence = "1234567890123456789012345678901234567890123456789012345678901234567890";
my $length = length $sequence;

for ( my $i = 0; $i < $length; $i += 37 ) {
    print substr($sequence, $i, 40) . "\n";
}

Nailed it! thanks

I was going so far down the other way of thinking... Thanks for the redirection!

Link to post
Share on other sites
On 12/19/2017 at 10:49 AM, haze1434 said:

I second crunch, can split files by line or bytes as I recall, and super fast. Can do on the fly as well, but if it locks at 40, you'd hit it in like under a second. Crunch is super fast. Just be sure to save the files in a new folder, don't run from root if you're going to split into thousands of files, and pick a good naming convention for when you want to remove them, making it easier to delete and clean up later.

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...