Welcome to HBH! If you have tried to register and didn't get a verification email, please using the following link to resend the verification email.

Python?


ghost's Avatar
0 0

Hey, i've got a friend thats trying to do her uni assignment with a bit of pythoon and i don't have a clue myself.

she wants to get this code to work but can't

if 'oracle' in line:
print "lines : ", lines```


she said shes trying to find out how many times people attempted to log into the oracle account and create a log of it.

Could anyone shed some light on this please?
she needs this done by tuesday 

Thanks





stealth-'s Avatar
Ninja Extreme
0 0

Um, you need to be more specific with what you want the output to be. Do you want it to output the number of lines that include the word "oracle", or print out the lines that include the word "oracle"?

That code is a mess, she really needs to pay attention in class o.0


ghost's Avatar
0 0

Output the lines the include oracal, i belive.

And i could agree more lol but shes struggling with it


spyware's Avatar
Banned
0 0

Didn't HBH have a stance on stupid homework questions?


stealth-'s Avatar
Ninja Extreme
0 0

Ragamuffin wrote:

if 'oracle' in line:
print "lines : ", lines```


Okay, tell her to look at the last line of her code.
"lines" is not a variable.....

Arabian's Avatar
Member
0 0

>>> for line in open ('auth.txt' ): if 'oracle' in line: print "lines : ", lines

Is she retarded? If her aim is to print out a value every time a user signs into an Oracle account,

A ) there is no account provided to scan for input. B ) She's attempting to scan and print out how many times 'oracle' occurs in 'auth.txt'.

Either you heard what she wanted to do wrong, or she's so far off that I don't even wanna help.


ynori7's Avatar
Future Emperor of Earth
0 0

Ragamuffin wrote: she said shes trying to find out how many times people attempted to log into the oracle account and create a log of it.

You can do this from oracle:

from ORASSO.WWSSO_AUDIT_LOG_TABLE$
where log_date > (sysdate - 7)
and MESSAGE = ‘Login failed’
order by log_date;```

You may have to tell the database to audit login attempts. Just google "oracle audit failed login attempts" and you'll find explanations.