Message Turncoat in a DM to get moderator attention

Users Online(? lurkers):
6 posts

This is what happens when you ask a simple question


Posts: 639

Yes, that's why it wouldn't work!! There was no way that it would ever evaluate to true because the array is indexed by zero but the len() function doesn't work that way. Never mind, I fixed it..

Posts: 639
This is what happens when you ask a simple question

I really need IRL friends.

Posts: 612
This is what happens when you ask a simple question

Yeah, it seems more like len() is an utility function for counting the real number of elements in an array rather than something that returns the index of the last filled array cell.

Posts: 612
This is what happens when you ask a simple question

>arrays go like 0 1 2 3 4

>attempt to make an assignment from argv[1]

>only arg[0] has something in it (./sploit.py is considered the first)

pffft pleb

Posts: 639
This is what happens when you ask a simple question

wait, or is the length 1?

Posts: 639
This is what happens when you ask a simple question

Yeah, I know that arrays are zero-indexed.

But what I don't understand is, I've got this if statement, right?

if len(sys.argv) < 1:

usage()

else:

HOST = sys.argv[1]

If I call sploit.py with no arguments, then the length of sys.argv should be 0, amirite? Which is less than one. So the first condition is true and the second part of the if statement should never be executed. Except that it is.

6 posts
This site contains NSFW material. To view and use this site, you must be 18+ years of age.