#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2015
    Posts
    2
    Rep Power
    0

    Expected an indented block


    Dear All

    This is the code and i am getting error
    Expected an indented block
    Can Somebody help me to fix the same

    Code:
    r = Request.FromProxyLog(1)
    r.Query.Set("email", "jack@pentesteracademy.com")
     
    bf = BruteForcer("xyz", 5,5)
    while bf.HasMore():
    password = bf.GetNext()
    r.Query.Set("password", password)
    res = r.Send()
    if res.BodyString.count("Failed! Please try again!") == 0:
    print "Password is - " + password
    break
    else:
    print password
    puneetbrar
  2. #2
  3. Forgotten Moderator
    Devshed Supreme Being (6500+ posts)

    Join Date
    Mar 2007
    Location
    Washington, USA
    Posts
    16,018
    Rep Power
    9616
    You're using Python. The very first thing you should have learned about the language is that you must indent your code properly.

    Comments on this post

    • b49P23TIvg agrees : appropriate answer for this password hacker
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    May 2009
    Posts
    647
    Rep Power
    39
    Start with one of the tutorials on the Python Wiki https://wiki.python.org/moin/BeginnersGuide/Programmers

    Comments on this post

    • b49P23TIvg agrees : appropriate answer for this password hacker
  6. #4
  7. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2015
    Posts
    2
    Rep Power
    0
    Can you please help me with the code how can i fix the same
  8. #5
  9. No Profile Picture
    Contributing User
    Devshed Loyal (3000 - 3499 posts)

    Join Date
    Dec 2004
    Posts
    3,082
    Rep Power
    379
    did you not read their comments?

    use indentations.. if you already have indentations but pasted your code wrong on here then you may be mixing tabs with spaces so make sure you only use one or the other! & convert all existing tabs to spaces or vice versa.
  10. #6
  11. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2015
    Location
    someplace between there and here
    Posts
    5
    Rep Power
    0
    your code should look like this(but use tabs, not spaces):
    Code:
    r = Request.FromProxyLog(1)
    r.Query.Set("email", "jack@pentesteracademy.com")
     
    bf = BruteForcer("xyz", 5,5)
    while bf.HasMore():
        password = bf.GetNext()
        r.Query.Set("password", password)
        res = r.Send()
    if res.BodyString.count("Failed! Please try again!") == 0:
        print "Password is - " + password
        break
    else:
        print password
  12. #7
  13. Contributing User
    Devshed God 1st Plane (5500 - 5999 posts)

    Join Date
    Aug 2011
    Posts
    5,792
    Rep Power
    508
    No, ambient. The code should not look like you've shown. You put a break outside a loop, which is a syntax error.
    Code:
    >>> if True:
    ...     break
    ... 
      File "<stdin>", line 2
    SyntaxError: 'break' outside loop
    >>> continue
      File "<stdin>", line 1
    SyntaxError: 'continue' not properly in loop
    >>>
    [code]Code tags[/code] are essential for python code and Makefiles!
  14. #8
  15. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2015
    Location
    someplace between there and here
    Posts
    5
    Rep Power
    0
    Originally Posted by b49P23TIvg
    No, ambient. The code should not look like you've shown. You put a break outside a loop, which is a syntax error.
    Code:
    >>> if True:
    ...     break
    ... 
      File "<stdin>", line 2
    SyntaxError: 'break' outside loop
    >>> continue
      File "<stdin>", line 1
    SyntaxError: 'continue' not properly in loop
    >>>
    ah, thanks for correcting me
  16. #9
  17. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2007
    Location
    Joensuu, Finland
    Posts
    471
    Rep Power
    69
    Originally Posted by ambient
    your code should look like this(but use tabs, not spaces):
    Actually, Style Guide for Python Code (PEP 8) clearly states that “[s]paces are the preferred indentation method”.

    Comments on this post

    • b49P23TIvg agrees : yes, it does say that.
    My armada: Debian GNU/Linux 8 (desktop, home laptop, work laptop), Raspbian GNU/Linux 8 (nameserver), Ubuntu 14.04.3 LTS (HTPC), PC-BSD 10.2 (testbed), Android 4.2.1 (tablet)

IMN logo majestic logo threadwatch logo seochat tools logo