Page 1 of 1

Question on how to format IF Contains statement

PostPosted: Mon Jan 07, 2013 10:29 am
by lowridertj
Im reading a file into a variable

And I want to see if something is contained within that variable regardless of case
How would I structure this in neobook?

your help is greatly appreciate and thank you in advance.

Re: Question on how to format IF Contains statement

PostPosted: Mon Jan 07, 2013 11:19 am
by dec
Hello,

With the information you provide, I think on a very simple way to search if an string is found in another string, just using the "SearchStr" NeoBook native action. More possible solutions can be available, using or not native NeoBook actions, for example, search for an string using Regular Expressions it is possible using my npRexp plugin. Anyway, take a look at the bellow sample, which use the "SearchStr" action to find an string into another previously loaded from a file:

http://neoplugins.com/?download/searchstr.zip

Hope this can help you in some manner. ;)

Host file check for distibuting software

PostPosted: Mon Jan 07, 2013 12:14 pm
by lowridertj
thank you that worked perfectly..

What I came up with was a host file check that could be incorporated for distrobution software, that is only 1 of many checks that should be performed.. but working out a massive system at the moment for it.

example code
Code: Select all
.CHECK HOSTS FILE
FileExists "[SystemDir]drivers\etc\hosts" "[hostfile]"
If "[hostfile]" "=" "False"
   .AlertBox "Error" "Cant find host file in [SystemDir]drivers\etc\hosts"
Else
    FileRead "[SystemDir]drivers\etc\hosts" "All" "[hostfile_details]"
    SearchStr "YOUR DOMAIN NAME HERE" "[hostfile_details]" "[found_in_host_file]"
if "[found_in_host_file]" ">" "0"
    SendMail "EMAIL TO" "EMAIL FROM" "Host File Hack Attempt" "A Host file hack was attempted with 'domain name' from ip: " "" "HideProgress"
    AlertBox "Error" "We have emailed support, We believe you to be attempting to run a pirated copy!"
    Exit "" ""
EndIf
    SearchStr "YOUR IP OF SERVER HOST HERE" "[hostfile_details]" "[found_in_host_file]"
if "[found_in_host_file]" ">" "0"
    SendMail "EMAIL TO" "EMAIL FROM" "Host File Hack Attempt" "A Host file hack was attempted with 'ip of server' from ip: " "" "HideProgress"
    AlertBox "Error" "We have emailed support, We believe you to be attempting to run a pirated copy!"
    Exit "" ""
EndIf

EndIf