Sign in to follow this  
Followers 0
Unc3nZureD

FileRead / FileReadLine

13 posts in this topic

Hello. I tried to use the FileRead & FileReadLine but i failed somewhere.

So the Code:

$DLL = FileExists(@ScriptDir & "/Base.dll")

If $DLL = 0 Then
    Msgbox(0, "Security!", "Please do not delete or change the Base.dll !")
    $answ = Msgbox(36, "Security!", "Do you want to download the original Base.dll ?")

    If $answ = 6 Then
        Local $hDownload = InetGet("An URL address - currently not uploaded", @ScriptDir & "Base.dll", 1, 1)
        Do
        Sleep(250)
        Until InetGetInfo($hDownload, 2)
        Local $nBytes = InetGetInfo($hDownload, 0)
        InetClose($hDownload)
    If $answ = 7 Then
        Msgbox(48, "Security!", "^ERROR")
        exit 0
    EndIf
    EndIf
EndIf

msgbox(0,"", $DLL)

$Check = FileReadLine(@ScriptDir & "/Base.dll")

If $Check Not = "Created by: [Unc3nZureD]" Then
    Msgbox(0, "DLL Guard!", "Please do not delete or change the Base.dll !")
    $answ = Msgbox(36, "DLL Guard!", "Do you want to download the original Base.dll ?")
    If $answ = 6 Then
            Local $hDownload = InetGet("An URL address - currently not uploaded", @ScriptDir & "Base.dll", 1, 1)
            Do
            Sleep(250)
            Until InetGetInfo($hDownload, 2)
            Local $nBytes = InetGetInfo($hDownload, 0)
            InetClose($hDownload)
            Sleep(500)
    If $answ = 7 Then
        Msgbox(48, "DLL Guard!", "^ERROR")
        exit 0
    EndIf
    EndIf
EndIf

msgbox(0,"",$Check)
msgbox(0,"","DONE")

To edit Base.dll , just open with a simple notepad and read the 1st line. It can find the file and able to read the 1st line but it says: "Created by: [unc3nZureD]" = "What The Hell??!!" Why?

Base.dll

Share this post


Link to post
Share on other sites



Are you opening/closing the file?

Share this post


Link to post
Share on other sites

What do u mean? It isn't opened when I run it.

Share this post


Link to post
Share on other sites

Look at the example on FileReadLine

and youl see $file = FileOpen("test.txt", 0)

look under FileReadLine second parametar and youl see "[, line] )"

Look under FileReadLine first parametar and youl see that there isnt any line telling you that first parametar is file path

The handle of a file, as returned by a previous call to FileOpen. Alternatively you may use a string filename as the first parameter.


TCP server and client - Learning about TCP servers and clients connection
Au3 oIrrlicht - Irrlicht project
Au3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related)



460px-Thief-4-temp-banner.jpg
There are those that believe that the perfect heist lies in the preparation.
Some say that it’s all in the timing, seizing the right opportunity. Others even say it’s the ability to leave no trace behind, be a ghost.

 

Share this post


Link to post
Share on other sites

But it says:

"If no line number to read is given, the "next" line will be read. ("Next" for a newly opened file is initially the first line.)"

But I will try to write 1 as line.

Share this post


Link to post
Share on other sites

Don't know why If i start the script it accept the "Created by: [unc3nZureD]" = "What The Hell??!!" and don't give my the choosing msgbox.

Share this post


Link to post
Share on other sites

The only thing I can see happening is that it's reading the first line of the dll and that first line says What The Hell??!!. I opened your dll file in notepad, and that is what the first line of the file says.

The only things wrong with your code are

  • You have the Not command after the $Check variable, and that's wrong, it has to be before it

  • In the same line, you are looking for the words "Created by: [unc3nZureD]" in the first line of the dll, and that's not what's in the first line of the dll, so that check will always be that $Check does not equal "Created by: [unc3nZureD]". You can modify it so that the check will fail correctly by changing the If Not $Check = "Created by: [unc3nZureD]" to If $Check <> "Created by: [unc3nZureD]" then.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

Why not do a checksum check instead of reading a single line from the file?

ETA: In case it interests you:

Edited by sleepydvdr

#include <ByteMe.au3>

Share this post


Link to post
Share on other sites

Why not do a checksum check instead of reading a single line from the file?

ETA: In case it interests you:

Wow, MD5 will be great, but a bit hard :P I think the LineCheck will be enough :shifty: Easy, simple, and a bit safe :x Thanks everything

Share this post


Link to post
Share on other sites

#10 ·  Posted (edited)

I have another problem :x

If $DLL = 0 Then
    Msgbox(0, "CoD 4 _ ESP-box [by Unc3nZureD]", "Please do not delete or change the Hook.dll !")
    $answ = Msgbox(36, "CoD 4 _ ESP-box [by Unc3nZureD]", "Do you want to download the original Hook.dll ?")

    If $answ = 6 Then
        Local $hDownload = InetGet("http://WarningHOOK.yolasite.com/resources/Hook.res", @ScriptDir & "Hook.dll", 1, 1)
        Do
        Sleep(250)
        Until InetGetInfo($hDownload, 2)
        Local $nBytes = InetGetInfo($hDownload, 0)
        InetClose($hDownload)
    If $answ = 7 Then
        Msgbox(48, "WarningHOOK", "^ERROR")
        exit 0
    EndIf
    EndIf
EndIf

When I Press NO Then it continues the script. (Same at the 2nd part of the script) Why? the Help file says:

Button Pressed Return Value

OK 1

CANCEL 2

ABORT 3

RETRY 4

IGNORE 5

YES 6

NO 7

TRY AGAIN ** 10

CONTINUE ** 11

So :

If $answ = 7 Then
msgbox(0,"","asd")
exit 0

But it isn't detect it :P

I tried to put this:

msgbox(0,"",$answ)
After the Yes/No. I pressed no and the answ was 7. So it's 7. Then why 7 don't = with 7 ? Edited by Unc3nZureD

Share this post


Link to post
Share on other sites

proper formatting tells a 1000 words:

If $DLL = 0 Then
    MsgBox(0, "CoD 4 _ ESP-box [by Unc3nZureD]", "Please do not delete or change the Hook.dll !")
    $answ = MsgBox(36, "CoD 4 _ ESP-box [by Unc3nZureD]", "Do you want to download the original Hook.dll ?")

    If $answ = 6 Then
        Local $hDownload = InetGet("http://WarningHOOK.yolasite.com/resources/Hook.res", @ScriptDir & "Hook.dll", 1, 1)
        Do
            Sleep(250)
        Until InetGetInfo($hDownload, 2)
        Local $nBytes = InetGetInfo($hDownload, 0)
        InetClose($hDownload)
        If $answ = 7 Then
            MsgBox(48, "WarningHOOK", "^ERROR")
            Exit 0
        EndIf
    EndIf
EndIf

Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

#12 ·  Posted (edited)

damn, sorry wrong script. I did that for another program, but i want the same security

The other one:

$DLL = FileExists(@ScriptDir & "/Base.dll")

If $DLL = 0 Then
    Msgbox(0, "Security!", "Please do not delete or change the Base.dll !")
    $answ = Msgbox(36, "Security!", "Do you want to download the original Base.dll ?")

    If $answ = 6 Then
        Local $hDownload = InetGet("An URL address - currently not uploaded", @ScriptDir & "Base.dll", 1, 1)
        Do
        Sleep(250)
        Until InetGetInfo($hDownload, 2)
        Local $nBytes = InetGetInfo($hDownload, 0)
        InetClose($hDownload)
    If $answ = 7 Then
        Msgbox(48, "Security!", "^ERROR")
        exit 0
    EndIf
    EndIf
EndIf
Edited by Unc3nZureD

Share this post


Link to post
Share on other sites

damn, sorry wrong script. I did that for another program, but i want the same security

of course

I have given the answer any ways so better now stick to our policies here.


Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.
Sign in to follow this  
Followers 0