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:
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.
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
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?
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
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="";