Hi my program file is 602,384 bytes, but I want it to be 602,624 so that it fits perfectly with something else, however whenever I add a random function that has no affect on the program it either does nothing or goes straight to 602,896 bytes which is too much.
Is there any way to add one byte at a time or something?
15 2278 JosAH 11,448
Recognized Expert MVP
Hi my program file is 602,384 bytes, but I want it to be 602,624 so that it fits perfectly with something else, however whenever I add a random function that has no affect on the program it either does nothing or goes straight to 602,896 bytes which is too much.
Is there any way to add one byte at a time or something?
Why do you want to do that?
kind regards,
Jos
Why do you want to do that?
kind regards,
Jos
Well autoconv.exe in windows xp is 602624 bytes and I am helping to increase security on a network. We currently use a software restriction policy and the hash rule performs a cryptographic calculation on the number of bytes in a file. Autoconv.exe is allowed to run, meaning any file with the exact same number of bytes is allowed to run also, no matter where it is located on the hard drive of the computer I want to run my program on. The software restriction policy hash rule relies on the fact that it is very unlikely any other file on the computer will have the same number of bytes in the file. The administrator of the network is allowing me to find ways round his security and then report back to him. I want to be able to give him a file which will operate despite his software restriction policy, but the file needs 602624 bytes and it can't be any lower for various reasons to do with the main function of the program.
Hope that makes sense
JosAH 11,448
Recognized Expert MVP
Hope that makes sense
Yep, it makes sense; add an initialized char array to your program, e.g. -
char filler[] ="thisisjustdummytextofthecorrectlength";
-
stick that array in an already existing source file.
kind regards,
Jos
Savage 1,764
Recognized Expert Top Contributor
Yep, it makes sense; add an initialized char array to your program, e.g. -
char filler[] ="thisisjustdummytextofthecorrectlength";
-
stick that array in an already existing source file.
kind regards,
Jos
Cheating!!!
:)
Savage
It's gone up to 602896 bytes with that in. Do you think my compiler (Dev-C++) is just not bothering with showing the exact number of bytes or windows isn't?
Methinks you've discovered why the security method is actually effective. It's statistically very difficult to get your file to *exactly* the right size when you factor in all the little optimizations/variations/base size requirements/storage overhead for some functions/variables. (lol @ huge number of slashes there XD)
Maybe try adding two plain chars, no pointers or anything, if that fails perhaps you can add some dummy assembly routines somewhere to pad stuff out. I'm admittedly no expert in software security, but it seems that those solutions may be viable.
Hi,
Sounds more like either your compiler or file system has block increments of 512bytes specified. Thjis is very normal on a unix based system - the larger block size uses more disk space but inreases other efficiencies.
I would suggest you investigate that route, then you should find you can add chunks to your code and get the more precise size changes you require.
Keith
Ah-- I should have caught that since I've been working on a chunk/block-based memory manager/allocator myself! Good point.
pbmods 5,821
Recognized Expert Expert
Well autoconv.exe in windows xp is 602624 bytes and I am helping to increase security on a network. We currently use a software restriction policy and the hash rule performs a cryptographic calculation on the number of bytes in a file. Autoconv.exe is allowed to run, meaning any file with the exact same number of bytes is allowed to run also, no matter where it is located on the hard drive of the computer I want to run my program on. The software restriction policy hash rule relies on the fact that it is very unlikely any other file on the computer will have the same number of bytes in the file. The administrator of the network is allowing me to find ways round his security and then report back to him. I want to be able to give him a file which will operate despite his software restriction policy, but the file needs 602624 bytes and it can't be any lower for various reasons to do with the main function of the program.
Wow. Post this to WTF!
[EDIT: Why not just create a list of allowed programs? Is Autoconv.exe really going to move around that much?]
pbmods 5,821
Recognized Expert Expert
Question: Can you Hex-edit your executable file and add null characters to the end of the file, or will this break the app?
Wow. Post this to WTF!
[EDIT: Why not just create a list of allowed programs? Is Autoconv.exe really going to move around that much?]
Lol! I'm afraid you misunderstand that I'm not the network administrator, I am trying to hack it for him to analyse security... don't think you quite understand my question...
pbmods 5,821
Recognized Expert Expert
Lol! I'm afraid you misunderstand that I'm not the network administrator, I am trying to hack it for him to analyse security... don't think you quite understand my question...
Oh yeah. The WTF was directed at your network admin :)
I dunno. I can think of too many situations where this model would break down. Please break it!
P.S., can you pad your executable file directly with nulls? Or does that break it?
Not really sure what you mean about padding it with nulls.
pbmods 5,821
Recognized Expert Expert
Heya niskin.
Not sure how you'd do it in Windows, but on my Mac, I could boot up my handy copy of HexEdit and append to the end of the file.
Alternatively, I copied TextEdit.app from my Applications folder to my Desktop and then I executed the following command: - echo " " >> ~/Desktop/TextEdit.app/Contents/MacOS/TextEdit
Double-clicking on the TextEdit icon on my desktop launches TextEdit as normal. So I would assume that appending to an executable file in Mac OS X does not necessarily break the application.
In Mac OS X. I dunno about Windows, though.
Thanks for all your posts, I have now changed the nature of my .exe and it no longer needs to be of a certain number of bytes as it can approach the problem in a slightly different way.
Thankyou for all your comments.
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: PeterB |
last post by:
Hi!
I am using the script below to download files, that are in a non-public
directory, from my site. The "smaller files" section works for smaller
files. However when the files are getting...
|
by: Alex |
last post by:
Hi all, can someone please show me how to get the size of a file with ANSI
C? both in text mode and binary mode.
thanks in advance.
|
by: Andrew Clark |
last post by:
*** post for FREE via your newsreader at post.newsfeed.com ***
Hello all,
I recall several threads over the years about how reading file size
cannot be done consistantly or portably, but I...
|
by: Roy |
last post by:
Hi,
I have a problem that I have been working with for a while.
I need to be able from server side (asp.net) to detect that the file i'm
streaming down to the client is saved...
|
by: Claudio Grondi |
last post by:
I have just started to play around with the bsddb3 module interfacing
the Berkeley Database.
Beside the intended database file
databaseFile.bdb
I see in same directory also the
__db.001...
| |
by: petermichaux |
last post by:
Hi,
I'm curious about server load and download time if I use one big
javascript file or break it into several smaller ones. Which is better?
(Please think of this as the first time the scripts...
|
by: =?Utf-8?B?VGhvbWFzWg==?= |
last post by:
Hi,
Is it possible to read a file in reverse and only get the last 100 bytes in
the file without reading the whole file from the begining? I have to get info
from files that are in the last 100...
|
by: niranjan.singh |
last post by:
This is regarding to test an SDK memory stuff.
In what situation malloc gets fail.
any comment/reply pls....
regards
|
by: Logan Lee |
last post by:
Hi. I've written a small program to learn to write in C. But unfortunately the output is all jumbled up and not nice.
/* read_file.c
The whole point of this code is to read the entire content...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
| |
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The...
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...
| |