Aug-17-2019, 04:27 AM
(Aug-17-2019, 02:13 AM)ichabod801 Wrote: The find method returns the start of the substring in the string. So your start variable is set to the beginning of the word 'user', that is, to the 'u'. You want to add five to it so your slice skips over the word 'user' and the space after it.
I tried this which is what I think you mean
start = line.find("invalid user"[5:])But it only takes out inval
I can only go up to 9 then it changes everything from
Output:id user root
id user root
id user root
id user root
id user root
id user root
id user root
id user root
id user roo
to thisOutput:er sshd[6488]: Failed password for invalid user root
er sshd[6490]: Failed password for invalid user root
er sshd[6490]: message repeated 2 times: [ Failed password for invalid user root
er sshd[6492]: Failed password for invalid user root
er sshd[6488]: message repeated 5 times: [ Failed password for invalid user root
er sshd[6492]: message repeated 2 times: [ Failed password for invalid user root
er sshd[6494]: Failed password for invalid user root
er sshd[6496]: Failed password for invalid user root
er sshd[6494]: message repeated 2 times: [ Failed password for invalid user root
er sshd[6501]: Failed password for invalid user root
er sshd[6496]: message repeated 5 times: [ Failed password for invalid user root
er sshd[6503]: Failed password for invalid user root
er sshd[6501]: message repeated 2 times: [ Failed password for invalid user root