Computing.Net > Forums > Disk Operating System > Check file size

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Check file size

Reply to Message Icon

Name: MajexticX
Date: March 13, 2003 at 00:14:32 Pacific
OS: DOS 6.22
CPU/Ram: 333/64
Comment:

Hi,
I'm trying to audit/snoop end-users computers with a batch file. What I need is a way to make sure that the users doesn't modify my file. I cannot use bat2exe because I have FOR loops in it. I'm thinking of some way to check that the file size stays the same. If you have other ideas I'll be glad to hear them.



Sponsored Link
Ads by Google

Response Number 1
Name: IVO
Date: March 13, 2003 at 01:57:35 Pacific
Reply:

The following tip is not bullet-proof nor an ultimate solution, but it may enforce the protection of your script against hacking.
Just add the command

Attrib +R +H Batch_File_Name

at the begin or end of the script.
It will hide and make it read-only.
I know this is far to be perfect, but it is simple and worked fine for me in a school environment.


0

Response Number 2
Name: Secret_Doom
Date: March 13, 2003 at 17:28:30 Pacific
Reply:

Checking the size could be another mechanism of protection. Here, this script checks it own size:

@echo off
if "%1"=="GoTo" goto %2
if exist %0.bat %0.bat

echo e100'SET %%1='> %temp%.\t1.bat
for %%? in (rcx 7 w q) do echo %%?>> %temp%.\t1.bat
type %temp%.\t1.bat |DEBUG %temp%.\t1.bat > nul
dir/z %0 |FIND " BAT " >> %temp%.\t1.bat
call %temp%.\t1.bat size
del %temp%.\t1.bat
call %0 GoTo :process %size%
if not "%size%"=="492" echo File corrupted.
set size=
goto eof

:process
if "%2"==":process" set SIZE=
if "%7"=="" goto eof
set size=%size%%5
shift
goto process
:eof

That's it. When you copy-paste it, it might carry some trailing zeroes or something so the file's length is not 492 bytes anymore. So, you would just have to change the number. The variable %SIZE% gets the batch file's own length in bytes, without thousand separators ('1024', not '1,024'). The script is compatible with most versions of DOS and also Win9x. It will not work on NT systems (Win NT, 2000, XP).

-- Leonardo Pignataro - Secret_Doom --

secret_doom@hotmail.com
www.batch.hpg.com.br

___________________________________________________________


0

Response Number 3
Name: Miskva
Date: March 15, 2003 at 03:08:01 Pacific
Reply:

All depends on the level of IQ of the "hackers" .. if they know you are checking the size, they gonna change the file to have same size, but different content ..

attributes may help, but experienced users will not take long to find that ..

what you could do, is retrieve the file from the clients, and compare it with a filecompare program, then you know who is tampering its files

then, you could replace the client file, just by forcing a copy .. or you could disable a certain client to perform certains functions .. so that the hackers know you are watching them


0

Response Number 4
Name: tHe mAdd pRoFeSsOr
Date: March 15, 2003 at 03:39:14 Pacific
Reply:

You can buy a little cheap device that plugs into the back of the computer and it records every keystroke and mouse click. I forgot the current price but its cheap, easy, and not noticeable or crackable. The recent catalog I got from CYBERGUYS had it for around 20 bux or something like that, but any wharehouse could probably supply it.
Punch Cyberguys into a search engine.


0

Response Number 5
Name: Miskva
Date: March 15, 2003 at 07:06:22 Pacific
Reply:

You can also post a United Nations inspector next to the end-users computer


0

Related Posts

See More



Sponsored Link
Ads by Google
Reply to Message Icon






Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Disk Operating System Forum Home


Sponsored links

Ads by Google


Results for: Check file size

Program to check file size www.computing.net/answers/dos/program-to-check-file-size/13835.html

File Size in DOS Batch file www.computing.net/answers/dos/file-size-in-dos-batch-file/3105.html

file size www.computing.net/answers/dos/file-size/13178.html