This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
pazzesco's profile picture

Ghosty, A Wireless Disk Cloning Utility

Started by pazzesco, 21 July 2013 - 01:26 AM
pazzesco #1
Posted 21 July 2013 - 03:26 AM
GHOSTY

Disk Cloning Utility


Disclaimer
SpoilerBY USING THIS SOFTWARE, YOU ACCEPT THE RISK OF ANY AND ALL LOSS, DAMAGE, OR UNSATISFACTORY PERFORMANCE OF THIS SOFTWARE OR PROGRAM RESTS WITH YOU AS THE USER. TO THE EXTENT PERMITTED BY LAW, NEITHER THE AUTHOR, NOR ANY PERSON EITHER EXPRESSLY OR IMPLICITLY, MAKES ANY REPRESENTATION OR WARRANTY REGARDING THE APPROPRIATENESS OF THE USE, OUTPUT, OR RESULTS OF THE USE OF THIS SOFTWARE OR PROGRAM IN TERMS OF ITS CORRECTNESS, ACCURACY, RELIABILITY, BEING CURRENT OR OTHERWISE. IF YOU RELY UPON THIS SOFTWARE OR PROGRAM, YOU DO SO AT YOUR OWN RISK, AND YOU ASSUME THE RESPONSIBILITY FOR THE RESULTS. SHOULD THIS SOFTWARE OR PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL LOSSES, INCLUDING, BUT NOT LIMITED TO, ANY NECESSARY SERVICING, REPAIR OR CORRECTION OF ANY PROPERTY INVOLVED.

Description
GHOSTY is a disk cloning utility that enables a user to create local hard disk images and either store them as a single file, upload them to a GHOSTY server in-game, or upload the image to Pastebin. These images can then be retrieved and installed via command prompt or through a GUI.
NOTE: Currently, binary file formats are not supported, and may corrupt a saved image.

Features
  • Can create backup images and save them to a local file, an in-game GHOSTY server, or to Pastebin.
  • Can be used via command line or through a GUI (run the program with no arguments).
  • Can install multiple images to a single computer at once.
  • Retreive single files from an image source or sources.
  • Client computers can be set into wait-for-image mode; they'll wait for a server to push an image.
  • One in-game GHOSTY server can host many images.

Download
GHOSTY v1.0.0 - http://pastebin.com/BftC03d4
To download to a computer, run: pastebin get BftC03d4 ghosty
NOTE: Command line arguments and their syntax have changed significantly in v0.9.6. Any previous version will behave differently using the currently listed arguments.

Quick Setup/Tutorial
  • Place a computer and attach a wireless modem to it.
  • Open computer terminal screen. Download GHOSTY with command given above.
  • Run command ghosty -s -a. This hosts a server.
  • Download GHOSTY to another computer (one you wish to backup).
  • Run command ghosty -i:imagename -make. This will make the image on the server.
  • Place another computer and attach a wireless modem to it.
  • Open terminal and download GHOSTY with command in download section.
  • Enter command ghosty -i:imagename -install. If all went well, you should have a duplicate file system.
[indent=1]Alternatively, run ghosty with no arguments to access the GUI.[/indent]

Program Arguments
'
-?:<topic>..............Displays help for a given topic.
-i:<image-name>.........Adds a target image as a GHOSTY server image.
-ipb:<pastebin-code>....Adds a target image as a Pastebin image.
-ifile:<filename>.......Adds a target image as a local hard disk file.
-install................Installs all target images, in order of arguments starting from left to right. THIS WILL ERASE ANY CURRENT DATA ON THE COMPUTER.
-make...................Creates/updates/uploads all target images, in order of arguments starting from left to right. THIS WILL REPLACE ALL TARGETED IMAGES.
-wait:<image-name>......Passively waits for a server to push an image, and then installs the image after receiving it. This feature only works with server images, and can only target one image. THIS WILL ERASE ANY CURRENT DATA ON THE COMPUTER.
-fget:<file>............Downloads a file/files from target images. If file exists in multiple targets, the first image (starting from left) containing the file is used. The file is placed in an identical local location.
-fget:<f>:<f>...
-s......................Hosts a GHOSTY server.
-name:<name>............Names the server, which is displayed in the server UI.
-images:<dir>...........Sets the root images directory for the server. Default is /images.
-a......................Auto-accept images from clients. By default, this is disabled.
-channel:<#>............Sets the modem channel in which to transmit on. This is useful for having multiple servers hosted in close proximity.
-nopurge................Will solely create/replace files on the client when an image is loaded instead of first wiping the system clean.
-purgesys...............Purges a system of all files (excluding the /rom and /disk directories). THIS WILL ERASE ANY CURRENT DATA ON THE COMPUTER.
'

Screenshots
Spoiler





Changelog
Spoiler1.0.0
  • UI added for client.
  • The server UI has been changed.
  • Code has been made much more modular.
0.9.8
  • Added argument -wait:<image-name>, which passively waits for a server to push an image, and then installs the image after receiving it. This feature only works with server images, and can only target one image.
  • Server GUI now allows a user to select an image and either delete it or push it to waiting clients.
  • Server protocol altered, making previous versions incompatible with the current.
0.9.7
  • Fixed a bug that was causing the modem to not properly close the connection after closing a server.
  • Added arguments -ch and -chan, which are synonymous to -channel.
  • Added argument -fget:<file>:<file>:…, which allows one or more files to be downloaded from all target images.
0.9.6
  • Fixed a bug that was causing servers to automatically decline image push requests after initially declining one.
  • Revamped how command line arguments are handled; code was refactored to be more sound in how it handled multiple arguments.
  • Removed command line arguments -pbupload, -pbupdate, -mkimage, -upload, and -update.
  • Changed argument -i:<image> to act as a targeting argument rather than an image installation argument.
  • Changed argument -ipb:<pastebin-code> to act as a targeting argument rather than an image installation argument.
  • Changed argument -ifile:<filename> to act as a targeting argument rather than an image installation argument.
  • Added argument -install, which installs a given target image.
  • Added argument -make, which creates an image and places it in given target.
  • Multiple images can now be installed in one command line.
  • Multiple images can be uploaded/updated/created in one command line.
0.9.5
  • Fixed a bug preventing a complete file system to be copied to Pastebin or a local image file.
  • Altered some string values that contained web addresses so Pastebin wouldn't flag uploads containing the GHOSTY script as spam.
  • Added help topics, and cleaned up initial help display.
  • Changed program argument -? to now include help topics. Its new usage is -?:<topic>.
  • Added program argument -purgesys, which will wipe a system clean (excluding the /rom and /disk directories).
0.9.4
  • Fixed a bug that wasn't allowing new images to upload to a server.
0.9.3
  • Added program argument -ifile:<file>. Using this will install a local image file to the hard disk.
  • Changed the program argument -mkimage:<file>. It now creates a single file of the hard disk's image instead of creating a blank image directory on the server.
  • Added program argument -pbupdate. Using this will create an image of the computer's hard disk and upload it to Pastebin. Does NOT currently work with hard disks that have binary files.
  • Added program argument -ipb:<pb-code>. Using this will download a GHOSTY image that was uploaded to Pastebin via GHOSTY.
  • Added program argument -nopurge. When used, will solely create/replace files on the client when an image is loaded instead of first wiping the system clean.
  • Added program argument -name, which if used, will place the server name in the lower right-hand corner of the screen.
0.9.2
  • Fixed a bug that wasn't allowing channel changes using the -channel argument.
0.9.1
  • Added program argument -upload, which is identical in effect to -update.
  • Fixed a bug that was preventing normal computers from creating images on a server.

Older Versions
Spoilerv0.9.8 - http://pastebin.com/KEP1nqCt
v0.9.7 - http://pastebin.com/XdMfw4qt
v0.9.6 - http://pastebin.com/1pVC0BPQ
v0.9.5 - http://pastebin.com/aXVTrqSX
v0.9.4 - http://pastebin.com/0yMYJKiA
v0.9.3 - http://pastebin.com/9ngdVr4A
v0.9.2 - pastebin link
v0.9.1 - pastebin link
v0.9.0 - pastebin link
Zudo #2
Posted 21 July 2013 - 03:32 AM
Looking good!
H4X0RZ #3
Posted 21 July 2013 - 03:56 AM
WTF!? After looking at your screenshot I've got very scared because the ghost looks like the ghost in pokemon!

If you now who burriedalive is you are scared to D:
mistertimn #4
Posted 21 July 2013 - 03:59 AM
Wow sweet! Can't wait to try this tomorrow. Should make it way easier to set up password computers for doors without having to run around with floppies.
mistertimn #5
Posted 21 July 2013 - 11:46 AM
Okay so I managed to get one image on the server, but any others don't seem to show up?
pazzesco #6
Posted 21 July 2013 - 12:09 PM
What command are you entering to upload the new image? And, is the server running and auto-accept turned on?
mistertimn #7
Posted 21 July 2013 - 12:22 PM
I set up the computer for the server as per the instructions with ghosty -s -a. Then I went to a computer that I needed an image of and did ghosty -update:imagename. Then I went to another computer I needed an image for, ran the same command, with a different image name of course, and only the first image showed up on the server computer.
pazzesco #8
Posted 21 July 2013 - 12:33 PM
Upload screenshots of the command to create the image and the server terminal screen after the command. Also, check in the /images directory to see if the image name exists.

EDIT: Please :)/>
mistertimn #9
Posted 21 July 2013 - 12:53 PM
Okay, here's the screenies:

Spoiler
Setting up the server


Server running


Uploading first image


First image on server


Uploading second image


Second image does not appear on server
pazzesco #10
Posted 21 July 2013 - 12:57 PM
Hmmm, are you playing in multiplayer? Would there be any way for me to access these terminals?
mistertimn #11
Posted 21 July 2013 - 01:03 PM
I'm not is MP, but the map I'm on was started in MP, I moved it to SP to do some work while I was away without having to put up a server. I'm also playing in Tekkit at the moment.
pazzesco #12
Posted 21 July 2013 - 01:08 PM
I'm in Tekkit too (1.5.2). Currently, my guess is that for some reason, the image directory isn't being made on the server computer. Try rebooting the server computer. If that doesn't work, try making other images from different computers.

EDIT: I'll attempt to recreate the problem. I just dug up a problem with transfers. Should hopefully have an updated version soon.
mistertimn #13
Posted 21 July 2013 - 01:50 PM
Nope, the image directory is there, and the first image is inside it, but not the second one. But when I set up another computer, an advanced one, the image uploads okay. So it will only accept images from advanced computers?
Edit: Even if I break the computer and place a new one down, copy the program I want on the image from the floppy it's on, and try to upload it, it doesn't show up.
pazzesco #14
Posted 21 July 2013 - 02:13 PM
Ahhh! Good observation! I patched it up, I'll upload v0.9.1 in just a moment…
mistertimn #15
Posted 21 July 2013 - 02:19 PM
Yaaaay I'm halping!

This will make my life so much easier when I need the same program on 5 computers in 5 different places. Now I won't need to run around with floppy disks.
pazzesco #16
Posted 21 July 2013 - 02:26 PM
New version is up. Try with an un-advanced computer; it should work.

EDIT: Halp is greatly appreciated, too.
mistertimn #17
Posted 21 July 2013 - 02:53 PM
It's all working a-okay now.
mistertimn #18
Posted 21 July 2013 - 04:56 PM
Wait, scratch that. I can't seem to change the channel number. When I type ghosty -channel:1000 or something it just lists all the available commands.
pazzesco #19
Posted 21 July 2013 - 05:43 PM
Wait, scratch that. I can't seem to change the channel number. When I type ghosty -channel:1000 or something it just lists all the available commands.

You have to either actively host a server with the -s argument, or download/upload an image. But, I did find another bug with the -channel argument. You'll want to download v0.9.2. Do that, and try ghosty -channel:1000 -s
mistertimn #20
Posted 21 July 2013 - 05:52 PM
Awesome! Will do.
mistertimn #21
Posted 22 July 2013 - 01:18 AM
I'm now getting an error with the ghosty -i:imageName command.
Spoiler

Thanks for being so quick with everything! This is a really awesome program!
pazzesco #22
Posted 22 July 2013 - 01:42 AM
Hmmm. That's an odd error message… have you tried rebooting the computer and downloading the image again? Sometimes, that "fixes" things. The area of code that's having the problem seems like an odd spot to have a problem.

I may have to address this tomorrow morning; the next version is amidst having pastebin imaging added to it (you can store images and download them via pastebin).
mistertimn #23
Posted 22 July 2013 - 03:10 AM
It seems to work on other computers, so I'll try that tomorrow. I'll try to be more thorough with trying stuff before posting here. Thanks for always bein so quick to respond!
pazzesco #24
Posted 22 July 2013 - 06:25 PM
I've posted v0.9.3. Let me know if that bug is still around.
DaGamer12345 #25
Posted 22 July 2013 - 09:16 PM
I found an error while trying to upload an image called "image1" to a Ghosty server:

Also, yes, in the background that is a turtle army.
pazzesco #26
Posted 22 July 2013 - 11:19 PM
Thank you for posting a screenshot! I'll address this as soon as I get home tomorrow night.
pazzesco #27
Posted 23 July 2013 - 11:55 AM
Fixed that bug. New version is up.
jesusthekiller #28
Posted 24 July 2013 - 12:17 PM
Nice, but your code isn't compact, right? 1400 lines per 'just' disk cloning utility is a lot!
pazzesco #29
Posted 24 July 2013 - 12:59 PM
Well, I could strip out all the white space/commenting and drop a few hundred lines. But, compactness isn't a concern just yet. I'm still in the process of building core features. Refactoring algorithms to drop a handful of lines of code resides lower on the priority list.
jesusthekiller #30
Posted 24 July 2013 - 01:01 PM
I mean: It could be done in less than 100 lines :P/>
pazzesco #31
Posted 24 July 2013 - 01:04 PM
Then do it. ;)/> If you can get implement a disk cloning utility that includes all the functionality in this in less than 100 lines of code, my hat is truly off to you, sir.
jesusthekiller #32
Posted 25 July 2013 - 05:26 AM
Then do it. ;)/> If you can get implement a disk cloning utility that includes all the functionality in this in less than 100 lines of code, my hat is truly off to you, sir.

Challenge accepted!
jesusthekiller #33
Posted 25 July 2013 - 07:19 AM
Behold of my mighty power! 77 lines (+3 for comment)! It does not include all functionalities ofc :P/>

It has 2 modes: (p)ack and (u)npack
Pack: Zip everything and send to pastebin
Unpack: Download from pastebin and unzip

Pastebin: http://pastebin.com/QCcTizHN
pazzesco #34
Posted 25 July 2013 - 11:23 AM
*squints eyes* Ahhh, I see that disclaimer! But regardless, I am impressed. Your code is elegant. I am taking note on your error handling and assertions. I am new to Lua, and it's taking a little getting used to.
jesusthekiller #35
Posted 25 July 2013 - 12:34 PM
Thanks :)/>
Mitchfizz05 #36
Posted 25 July 2013 - 05:33 PM
Are you planning a GUI version?
That would be cool - cause that looks quite complicated…
pazzesco #37
Posted 25 July 2013 - 06:02 PM
There's actually another forum member who's working on a GUI AddOn version of this. Though, I remain independent from that project. As of right now, there are still many features being developed that were planned, and some unplanned. Once I feel like the program is a fully functioning utility, I'd consider making a text-based GUI option for both client and server. I'd like to keep the utility available on both normal and advanced CC computers alike, so a GUI beyond a monochrome text-based one (which is partially what the server uses for the moment) is off the table.

So in short, yes, but only once the core program is finished.
pazzesco #38
Posted 02 August 2013 - 01:47 PM
A version of GHOSTY has been adapted to Encreedem's Graffiti API. Check it out!
justync7 #39
Posted 02 August 2013 - 03:27 PM
Sweeeet! Looks great :lol:/>
lifewcody #40
Posted 03 August 2013 - 11:37 AM
Cool idea
pazzesco #41
Posted 19 August 2013 - 02:20 AM
Version 1.0.0 released! Includes a GUI for both client and server. Or, you can stick with command line. Code has been switched up, as I'm molding it to be more modular. Code size is massive; it is a conglomeration of GHOSTY modules and a GUI framework I've conjured, which constitutes half of the file size.

At any rate, it's worth taking a peek at if nothing else.