Ich möchte an dieser Stelle einfach mal los werden, dass es sich wirklich lohnt, ADAC-Mitglied zu werden! Die holen einem aus jeder erdenklichen misslichen bis unlösbaren Lage raus (alles von, Tank auf der Autobahn leer bis man bleibt in Spanien liegen). Die 80€ im Jahr sind es wert!
Here's my code for quickly uploading files to virustotal and retrieving the reports.
import postfile
import sys
import json
from StringIO import StringIO
import urllib
import urllib2
import time
import webbrowser
apikey = 'YOUR API KEY ' + \
' GOES HERE '
resources = []
for i in range(1, len(sys.argv)):
file = sys.argv[i]
print 'Preparing Scan of %s ...' % file
host = 'www.virustotal.com'
selector = 'https://www.virustotal.com/vtapi/v2/file/scan'
fields = [('apikey', apikey)]
file_to_send = open(file, 'rb').read()
files = [('file', file, file_to_send)]
print 'Uploading file...'
ret = postfile.post_multipart(host, selector, fields, files)
try:
data = json.loads(ret)
except ValueError:
print 'Cannot decode server response: '
print ret
exit()
print 'Upload done.'
# for k in data: print '%s: %s' % (k, data[k])
resources.append((file, data['resource']))
print 'Retreiving reports...'
i = 1
permalinks = []
for resource in resources:
response_code = 0
while response_code == 0:
url = 'https://www.virustotal.com/vtapi/v2/file/report'
parameters = {
'resource': resource[1],
'apikey': apikey
}
data = urllib.urlencode(parameters)
req = urllib2.Request(url, data)
response = urllib2.urlopen(req)
ret = response.read()
data = json.loads(ret)
response_code = data['response_code']
#print json.dumps(data, sort_keys=True, indent=4)
if response_code == 0: time.sleep(5)
#print json.dumps(data, sort_keys=True, indent=4)
permalinks.append(data['permalink'])
print '%2i: %s' % (i, resource[0]),
print ': %i / %i' % (data['positives'], data['total'])
i += 1
wb = webbrowser.get()
selection = 0
while selection >= 0 and selection < len(permalinks):
selection = int(raw_input('Open: '))-1
if selection >= 0 and selection < len(permalinks):
wb.open(permalinks[selection])
P.S.: This is all part of a great plan I'm following at the moment.
Edit (2013-09-05): Since the VirusTotal API is now out there for a while, a lot of awesome python libraries have emerged:
* https://github.com/Erethon/vta.py
* https://github.com/Gawen/virustotal
* https://github.com/botherder/virustotal
* https://github.com/Xen0ph0n/VirusTotal_API_Tool
Lars has put together a rather disturbingly large list of objects that are either useless or dyfunctional. Most of them have pretty YouTube Videos. Maybe one of them makes for a great gift. Do you want to look at them?
Just a checklist for programming the microncontroller Ralf gave me yesterday ((Also check out this useful article))
* you need a functional eclipse installation
* Install WinAVR and be sure that it is in the
PATH
by executing avr-gcc
from a command prompt
* Install the AVR-Interface into eclipse via Help
→ Install New Software
→ Add
. Then paste the following link in the URL Box:
http://avr-eclipse.sourceforge.net/updatesite/
* When I create a new project, I need to adjust the following settings in the project properties:
* AVR
→ AVRDude
Programmer
click on New
, Name: USBASP
, Programmer Hardware (-c
) USBasp, http://www.fischl.de/usbasp/
* AVR
→ AVRDude
, Advance
be sure the check Disable device signature check
* AVR
→ Target Hardware MCU Type
select ATmega168
and set the MCU Clock Frequency
to 12000000
(that's $12\cdot10^6$)
* C/C++-Build
→ Settings unter Tool Settings
check Generate HEX file for Flash memory
* C/C++-Build
→ Settings unter Tool Settings
, AVR Compiler
→ Optimization
set the Optimization Level
to Size Optimizations (-Os)
.
Just a quick note to everybody that wants to copy a file from (an old) hard drive and keeps getting a "Data error (cyclic redundancy check)" (either in the explorer and in a shell using various commands to copy): Download and use PC Inspector File Recovery (execute it with admin privileges).
I found a site full of examples to create knots in latex and it's quite a pain to paint them. They look nice, though.
You basically paint them via xy and then place *"holes"* in the parts where you want to make a crossing. Here is an example:
\xy
(-3.5,3.5)*{}="LEFTTOP";
(3.5,-3.5)*{}="RIGHTBOTTOM";
(3.5,3.5)*{}="RIGHTTOP";
(-3.5,-3.5)*{}="LEFTBOTTOM";
"LEFTTOP";"RIGHTBOTTOM" **\dir{-}; \POS?(.5)*{\hole}="HOLE";
"RIGHTTOP";"HOLE" **\dir{-};
"HOLE";"LEFTBOTTOM" **\dir{-};
(0,0)*[gray]\xycircle(5,5){-};
\endxy
Everyone who tried to get isolate compiled tex-code in an svg knows that this is kind of complicated if you try to do it by hand and via manual picture editing. So it sounds convenient that there exists a software that inputs Tex-Code in a software like Inscape ... and so it is! After running into a lot of 32 / 64 bit problems and some weird dll-issues when I had ImageMagick or GraphicsMagick installed I finally got the following to work (assuming that you have Miktex installed):
* Inkscape 0.46 (not motivated to install it in the current version and it now runs though)
* Download and Install pstoedit (be sure to install it without this Magick-Integration and put the folder of the executable in your path).
* Download and Install textext.
For those who are interested (i.e. myself, when I try to set it up on someone else's computer), here are the details. For faster debugging I used and edited the textext.py-File in the Inkscape Extension Folder:
Func SendF($str)
$clip = ClipGet()
ClipPut($str)
Send("^v")
ClipPut($clip)
EndFunc
Run('PATHTO046\inkscape.exe')
WinWaitActive('New document')
Send('^o')
WinWaitActive('Select file')
SendF('PATHTO\test.svg')
Send('{ENTER}')
WinWaitActive('test.svg')
Send('!c{DOWN 8}{ENTER}')
WinWaitActive('TeX Text')
SendF('$\alpha\leq\beta$')
Send('!o')
to finally get that it calls something like
pstoedit -f plot-svg tmp.pdf test.svg -dt -ssp -psarg -r9600x9600
which results in the errors I then tracked down to the problems with CORE_RL_Magick++_.dll
. Links that helped me:
* http://www.calcmaster.net/personal_projects/pdf2svg/
* http://pav.iki.fi/software/textext/
* http://www.pstoedit.net/