Jump to content
Sign in to follow this  
dbzfanatic

Compression and Autoit

Recommended Posts

dbzfanatic

How do I compress a file in autoit? Is there a UDF or an algorithm I can use? I've looked around but didn't find anything. I don't want to use standard zip or rar compression so is there a way I can make my own or use a different kind in autoit?

Share this post


Link to post
Share on other sites
PsaltyDS

How do I compress a file in autoit? Is there a UDF or an algorithm I can use? I've looked around but didn't find anything. I don't want to use standard zip or rar compression so is there a way I can make my own or use a different kind in autoit?

7-zip...?

;)


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites
dbzfanatic

No that's no fun ;) I want to do it in pure autoit. I've tried reading a file in binary mode to try to make my own simple method but it seems to return hex instead of binary, did I do something wrong?

Share this post


Link to post
Share on other sites
dbzfanatic
AdmiralAlkex

No that's no fun ;) I want to do it in pure autoit. I've tried reading a file in binary mode to try to make my own simple method but it seems to return hex instead of binary, did I do something wrong?

No, that's how things work. You should use Binary(), BinaryToString() etc to convert between formats.

Share this post


Link to post
Share on other sites
dbzfanatic
Airwolf

AutoIt has UPX built-in to compress your scripts. If you are only referring to a "zip" type compression, then the fact that it is an AutoIt file is irrelevant. There are many compression utilities available; what would be the point of creating your own? You'd be the only person who could de-compress it. If encryption is what you're after, then try TrueCrypt.

Edited by Airwolf

Certifications: A+, Network+, Security+, Linux+, LPIC-1, MCSA | Languages: AutoIt, C, SQL, .NETBooks: AutoIt v3: Your Quick Guide - $7.99 - O'Reilly Media - September 2007-------->[u]AutoIt v3 Development - newbie to g33k[/u] - Coming Soon - Fate Publishing - Spring 2013UDF Libraries: SkypeCOM UDF Library | ADUC Computers OU Cleanup | Find PixelChecksumExamples: Skype COM Examples - Skype4COMLib Examples converted from VBS to AutoIt

Share this post


Link to post
Share on other sites
dbzfanatic

I'm trying to create a simple compression method in autoit just for fun. If it works and is viable I'd actually post the code and encryption isn't really what I'm seeking. I want to have a compression algorithm written completely in autoit if at all possible, and really just want to prove to myself that I can with or without help. Also as a clarification I'm not trying to compress my scripts, I want the method to compress other files.

Edited by dbzfanatic

Share this post


Link to post
Share on other sites
SmOke_N

If you're using the latest beta, you can use StringToASCIIArray() after reading the file, and work with each individual decimal character value by itself. The hex for StringToBinary/BinaryToString is so you can read the characters in a message box or console, otherwise the "string" would be cut off at any non-printable character.


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.

Share this post


Link to post
Share on other sites
dbzfanatic

Thanks, I'll try that. By the way, what file is that in? I included String.au3 and Array.au3 but it still says undefined function. I have the latest beta installed and I'm running the full version of SciTe.

Share this post


Link to post
Share on other sites
SmOke_N

Thanks, I'll try that. By the way, what file is that in? I included String.au3 and Array.au3 but it still says undefined function. I have the latest beta installed and I'm running the full version of SciTe.

It's not in any file, it's a standard function in the beta. Make sure you not only have the latest beta, but you are actually trying to run it (Alt+F5 in SciTe).

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.

Share this post


Link to post
Share on other sites
dbzfanatic

*Slaps forehead* D'oh! I was pressing F5 and not Alt+F5. Thank you. Is there a way to see if a number is prime and if not find the largest number it can be divided by?

Share this post


Link to post
Share on other sites
Airwolf

You should be able to use FileOpen() in binary/byte mode. Then use a FileRead() as usual on that file.

$file = FileOpen("filename.exe",16)
$binarydata = FileRead($file)

Certifications: A+, Network+, Security+, Linux+, LPIC-1, MCSA | Languages: AutoIt, C, SQL, .NETBooks: AutoIt v3: Your Quick Guide - $7.99 - O'Reilly Media - September 2007-------->[u]AutoIt v3 Development - newbie to g33k[/u] - Coming Soon - Fate Publishing - Spring 2013UDF Libraries: SkypeCOM UDF Library | ADUC Computers OU Cleanup | Find PixelChecksumExamples: Skype COM Examples - Skype4COMLib Examples converted from VBS to AutoIt

Share this post


Link to post
Share on other sites
SmOke_N

*Slaps forehead* D'oh! I was pressing F5 and not Alt+F5. Thank you. Is there a way to see if a number is prime and if not find the largest number it can be divided by?

Search for IsPrime() on the forum and look at Mod() in the help file for the 2nd part of your question.

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.

Share this post


Link to post
Share on other sites
dbzfanatic

Share this post


Link to post
Share on other sites
SmOke_N

Already tried it. Didn't seem to work as needed.

Sorry, the crystal ball is broken today, and my remote desktop session to your PC seems to have expired.

Please don't make us run in circles... don't say things like the above without posting code you've actually tried, what results you get when you try the code, and what you wish the desired output to be.

Edit:

I'm going to assume you were speaking to the other gent with your post... after seeing your edit.

Edited by SmOke_N

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.

Share this post


Link to post
Share on other sites
dbzfanatic

Sorry, the crystal ball is broken today, and my remote desktop session to your PC seems to have expired.

Please don't make us run in circles... don't say things like the above without posting code you've actually tried, what results you get when you try the code, and what you wish the desired output to be.

Edit:

I'm going to assume you were speaking to the other gent with your post... after seeing your edit.

I was and I have already posted example output from reading in Binary Mode. It was output as a hex string instead of a binary, which PsaltyDS seemed to explain was so that it wouldn't crash when it came upon a non-printable character,which makes sense. However I'm the type of person who needs to see the exact data being worked with so for me this isn't a viable solution unless I can get a bit more help. I've tried a few different methods up to this point,changing the code around so I have none to post ATM, and all of it either resulted in the same filesize or a greater size.

Share this post


Link to post
Share on other sites
Airwolf

I was and I have already posted example output from reading in Binary Mode. It was output as a hex string instead of a binary, which PsaltyDS seemed to explain was so that it wouldn't crash when it came upon a non-printable character,which makes sense. However I'm the type of person who needs to see the exact data being worked with so for me this isn't a viable solution unless I can get a bit more help. I've tried a few different methods up to this point,changing the code around so I have none to post ATM, and all of it either resulted in the same filesize or a greater size.

It definitely helps to post your source code. It's hard to fix an engine problem in a car without having it in front of you.


Certifications: A+, Network+, Security+, Linux+, LPIC-1, MCSA | Languages: AutoIt, C, SQL, .NETBooks: AutoIt v3: Your Quick Guide - $7.99 - O'Reilly Media - September 2007-------->[u]AutoIt v3 Development - newbie to g33k[/u] - Coming Soon - Fate Publishing - Spring 2013UDF Libraries: SkypeCOM UDF Library | ADUC Computers OU Cleanup | Find PixelChecksumExamples: Skype COM Examples - Skype4COMLib Examples converted from VBS to AutoIt

Share this post


Link to post
Share on other sites
dbzfanatic

Here's the code I've gotten up to. I'm aware that it sucks but I'm tired and I'm going to go to sleep, maybe I'll be able to think more clearly when I wake up. Have a look and see if you can give any suggestions. There is an error that the array $binary somehow gets reset to nothing but I don't understand how.

#include <String.au3>
#include <Array.au3>

Dim $n, $f, $binary_encrypted, $pass, $pass2

$binary = FileOpen("concept.txt",16)

$binary = FileRead($binary)

$binary = StringToAsciiArray($binary)

For $n = 0 To UBound($binary) - 2
    $f = $n + 2
    $pass = $binary[$f]
    $pass2 = $pass2 & $pass & "|"
    $n = $n + 1
Next

$pass = StringSplit($pass2,"|")

$pass2 = ""

$n = 1

For $n = 1 To UBound($pass) - 1
    $pass2 = $pass2 & Chr($pass[$n])
Next

$n = 0
$f = 0

For $n = 0 To UBound($binary) - 2
    $f = $n + 2
    $binary = StringReplace($binary,$binary[$f],"",1)
    $n = $n + 1
Next

$len = UBound($binary)

For $n = 0 To $len - 1
    $binary_encrypted = $binary_encrypted & Chr($binary[$n])
Next

MsgBox(0,"",$binary_encrypted)

;FileWrite(@DesktopDir & "\log.etf",$binary_encrypted)

MsgBox(0,"",$pass2)

Share this post


Link to post
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
Sign in to follow this  

×