Jump to content

How do change filesize everytime program runs?


Recommended Posts

  • Moderators

How to? Any idea?

I was trying to include randomly generated file, but it ain't working.

Thanks in advance.

It's only going to flag that exe as a threat doing something like that :whistle:...

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

Sry, sry - I was away a bit.

I'm explaining it right now...

I want to make something like "extreamly hard to detect cheat base" for... dunno, css cheats (I got one - which slows my shooting, for better accuracy).

Here is code:

; What to do:
; randomize filesize
; randomize file creation time

; 07.07.2007 -> 08.07.2007 -> 09.07.2007
; Kecz4p
If DriveGetFileSystem(StringLeft(@ScriptDir, 3)) <> "NTFS" Then
    MsgBox(0, StringTrimRight(@ScriptName, 4), "NTFS filesystem only.")
    Exit
EndIf
Dim $useOnce[2] = [0, 0]
If $CmdLine[0] > 0 Then
    For $i = 1 To $CmdLine[0] Step 1
        Switch $CmdLine[$i]
            Case "/?"
            ; DOS-based help needed..!
                Msgbox(0, StringTrimRight(@ScriptName, 4), "Help:" & @CRLF & " baseName - go back to scripts base name" & @CRLF & " safeMode:[ON/OFF] - set random filename generation on/off")
                Exit
            Case "safeMode:ON"
                If $useOnce[0] Then
                    Exit
                Else
                    IniWrite(@ScriptName & ":ini", "main", "safeMode", "1")
                    If Not $useOnce[1] Then IniWrite(@ScriptName & ":ini", "main", "genName", "1")
                    $useOnce[0] = 1
                EndIf
            Case "safeMode:OFF"
                If $useOnce[0] Then
                    Exit
                Else
                    IniWrite(@ScriptName & ":ini", "main", "safeMode", "0")
                    If Not $useOnce[1] Then IniWrite(@ScriptName & ":ini", "main", "genName", "0")
                    $useOnce[0] = 1
                EndIf
            Case "baseName"
                If $useOnce[1] Then
                    Exit
                Else
                    IniWrite(@ScriptName & ":ini", "main", "genName", "-1")
                    $useOnce[1] = 1
                EndIf
        EndSwitch
    Next
EndIf
If @Compiled Then
    $newName = ""
    Switch Int(IniRead(@ScriptName & ":ini", "main", "genName", "0"))
        Case 1
            #NoTrayIcon
            Do
                Sleep(2)
                $newName = _GetRandName(0) & ".exe"
            Until FileMove(@ScriptName, $newName, 0)
        Case -1
            #NoTrayIcon
            $newName = "some_code.exe"
            FileMove(@ScriptName, $newName, 1)
    EndSwitch
    If $newName Then
        IniWrite($newName & ":ini", "main", "genName", "0")
        Run($newName)
        Exit
    EndIf
EndIf

#include <Misc.au3>
#Include <Constants.au3>

if Not _Singleton("hack base", 1) Then
    Msgbox(0, StringTrimRight(@ScriptName, 4), "Multirun use detected.", 1)
    Exit
EndIf

Opt("OnExitFunc", "_Exit")
Opt("TrayMenuMode", 1)

HotKeySet("{NUMPADSUB}", "_Exit")

$name = StringTrimRight(@ScriptName, 4)
$ini = @ScriptName & ":ini"

TrayCreateItem("")
$about = TrayCreateItem("About")
$exit = TrayCreateItem("Exit")
TraySetClick(8)
TraySetToolTip($name)
TraySetState(1)

Func _GetRandName($special = 1, $min = 8, $max = 12)
    If $min < 1 Then Return 0
    If $max > 32 Then Return 0
    If $min > $max Then Return 0
    $str = ""
    $max = Random($min, $max, 1)
    For $i = 1 To $max Step 1
        If $i = 1 Or $i = $max Or Not $special Then
            $num = Random(1, 9, 1)
        Else
            $num = Random(1, 10, 1)
        EndIf
        Switch $num
            Case 1 To 3
                $str &= Chr(Random(97, 122, 1))
            Case 4 To 6
                $str &= Chr(Random(65, 90, 1))
            Case 7 To 9
                $str &= Random(0, 9, 1)
            Case 10
                Switch Random(1, 23, 1)
                    Case 1
                        $str &= "!"
                    Case 2
                        $str &= "#"
                    Case 3
                        $str &= "$"
                    Case 4
                        $str &= "%"
                    Case 5
                        $str &= "&"
                    Case 6
                        $str &= "`"
                    Case 7
                        $str &= "("
                    Case 8
                        $str &= ")"
                    Case 9
                        $str &= "+"
                    Case 10
                        $str &= ","
                    Case 11
                        $str &= "-"
                    Case 12
                        $str &= "."
                    Case 13
                        $str &= ";"
                    Case 14
                        $str &= "="
                    Case 15
                        $str &= "@"
                    Case 16
                        $str &= "["
                    Case 17
                        $str &= "]"
                    Case 18
                        $str &= "^"
                    Case 19
                        $str &= "_"
                    Case 20
                        $str &= "'"
                    Case 21
                        $str &= "{"
                    Case 22
                        $str &= "}"
                    Case 23
                        $str &= "~"
                EndSwitch
        EndSwitch
    Next
    Return $str
EndFunc

Func _Exit()
    If Int(IniRead($ini, "main", "safeMode", "0")) Then IniWrite($ini, "main", "genName", "1")
    HotKeySet("{NUMPADSUB}")
    Exit
EndFunc

While 1
    Sleep(2)
    TrayTip($name, "This script does nothing...", 1)
WEnd

Queoted parts are the one I need to solve out (random size, creation date, DOS-like help msg).

Edited by fastnick1oo
SciTE - much better than notepad. ; ]
Link to comment
Share on other sites

...anyone?

@Volly

As i can see, all ppl who know much (more) about coding have it's own sense od "good and evil". If someone tries to code soemthing "dangerous" they stop providing help. It's... hmm...

Coding is my hobby, I really enjoy it, every new stuff I'm trying to do is sorta like adventure to find answer. Not to use it in "hell's-millenium-virus-of-all-the-times-to-destroy-the-earth". ; P

If you can't provide me with straight-to-do help, could you point me a direction?

...and what about "DOS-like help msg"?

Peace! ; )

Edited by fastnick1oo
SciTE - much better than notepad. ; ]
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...