Question - How to generate ongoing numbers and use a random string more than once

Hey guys,

url = “https://api.site.com/api=8585858585&code=AAAAAAAAAAA<10randomdigits>&pin=”

I am currently trying to generate a GET Request with random strings in an URL and check them with a text file which has numbers from 0000 to 9999.
is there a way to do it without the textfile?

how do I keep the string for all of the combinations the same?
example:

url = “https://api.site.com/api=8585858585&code=91753397159300315438138&pin=0001
url = “https://api.site.com/api=8585858585&code=91753397159300315438138&pin=0002
url = “https://api.site.com/api=8585858585&code=91753397159300315438138&pin=0003
url = “https://api.site.com/api=8585858585&code=91753397159300315438138&pin=0004
etc… until

url = “https://api.site.com/api=8585858585&code=91753397159300315438138&pin=9999

Or if for example this is the right PIN:

https://api.site.com/api=8585858585&code=91753397159300315438138&pin=5555

how do i let it stop and generate the next random string?
example:

https://api.site.com/api=8585858585&code=91753397159338196464864&pin=0000
https://api.site.com/api=8585858585&code=91753397159338196464864&pin=0001

Any help is very appreciated!
Thanks in advance :slight_smile:

Did u try using loops

no, i dont know how to make the loop to only loop one variable and not the other

can you help me with writing the code? @Ruri

Have you tried the Combinations data pool? I made it for this exact purpose. Or do you need to loop inside the config itself? Let me know and I will give you the code, I already wrote this function in RuriLib so it’s accessible from configs via LoliCode.

1 Like

If the bot knows the keys it checked then i dont need it in the config itself

I did not try the combination data pool, is there a guide? I didn‘t find one via the search bar.

If there is any solution i would very appreciate that! :slight_smile:

Basically when you create a Multi Run Job, instead of selecting a wordlist, you can choose the combinations data pool and it will generate all possible combinations of characters with a given length.

Anyways, try putting this in your LoliCode section. It will generate a list of combinations with the given charset and length. You can then loop on that list (there is a guide for that on this forum).

string charSet = "0123456789";
int length = 4;

List<string> combinations = charSet.Select(x => x.ToString()).ToList();
for (var i = 0; i < length - 1; i++)
    combinations = combinations.SelectMany(x => charSet, (x, y) => x + y).ToList();
    
LOG combinations

Thanks for that @Ruri Ruri, could you tell me how i can automate it to check the API Key 10.000 times? For all the combinations?
Like key#1 0000-9999
Key#2 0000-9999
Key#3 0000-9999

I want to generate the keys automatically by random strings and add the checking of the pins, thank you :slight_smile:

Not sure I understand. What do you have in your wordlist? Don’t you already have the possible keys?

Yes i do have all the combinations in my wordlist, but there are 2 values needed.

  • the worldlist values
  • and the values which generate randomly to get checked by the wordlist

I see 3 components in your request

  • api
  • code
  • pin

So, let me get this straight, in your wordlist you have a bunch of values for the api parameter and then, for each one of them, inside the config, you want to try many different values of code and pin. This is basically a double nested loop with a huge time complexity since you’re looking at 10^10 complexity on the 10 random digits of the code times 10^4 complexity on the 4 digits of the pin which means 10^14 overall complexity. Basically I think it’s more likely that you win the lottery than guessing this combination. Are you really sure this is what you want to do?

The api is no variable, its a set value. The 2 variables are Code and pin. I have the algorithm for the „code“ value. And i have to try all the combinations for the pin value which is a 4 digit numeric. In my wordlist there are the digits 0000-9999 which are the values for „PIN“.
I just have to set the code value to not change as long as it did not check the whole wordlist, or find the right pin before finishing.

Okay but, for each code you want to try all pins. So wouldn’t it make more sense to put the possible codes in the wordlist and just loop over the pins inside the body of the config instead of doing the opposite?

That would make more sense to be honest :smiley:
Could you help me with the code?

Ok so I selected the Numeric wordlist type in the debugger, wrote 123456789 in the test data field and then ran this LoliCode which should loop over all pins.

string charSet = "0123456789";
int length = 4;

List<string> PINS = charSet.Select(x => x.ToString()).ToList();
for (var i = 0; i < length - 1; i++)
    PINS = PINS.SelectMany(x => charSet, (x, y) => x + y).ToList();
    
FOREACH PIN IN PINS

CLOG Turquoise $"Trying pin {PIN}"

// Make your HTTP request here
BLOCK:HttpRequest
  url = "https://httpbin.org/anything"
  method = POST
  TYPE:STANDARD
  $"{\"code\": \"<input.CODE>\", \"pin\": <PIN>\"}"
  "application/json"
ENDBLOCK

// This is basically like a keycheck for the correct pin
IF STRINGKEY @data.SOURCE Contains "my success key"
data.STATUS = "SUCCESS";
return;
END

// If the pin was not correct, it will go back to the FOREACH and try with the next pin
END

Let me know if you have any problems

2 Likes

using System;

for(int i=0;i<=10;i++)
{
    int len=i.ToString().Length;
    Random r=new Random();
    var s=r.Next(10000,99999);
    var t=r.Next(10000,99999);
    var n=s+""+t;
    string v="";

    if(len<=4)
    {
        while(4-len>0)
        {
            v=v+"0";
            len++;
        }
    }
    v=v+i;
    string url=$"https://api.site.com/api=8585858585&code={n}&pin={v}";
    Console.WriteLine(url);
    v="";
}

Try this. thank you

If you don’t want to use loop because the loop checks one by one. But you want random then


    Random r=new Random();
    var s=r.Next(10000,99999);
    var t=r.Next(10000,99999);
    var i=r.Next(1000);
    var n=s+""+t;
    string v="";


    int len=i.ToString().Length;
    if(len<=4)
    {
        while(4-len>0)
        {
            v=v+"0";
            len++;
        }
    }
    v=v+i;
    string url=$"https://api.site.com/api=8585858585&code={n}&pin={v}";
    Console.WriteLine(url);
    v="";