Advertisement
Guest User

Untitled

a guest
Dec 12th, 2017
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var Client = require('ftp');
  2. var fs = require('fs');
  3. var request = require('request');
  4. var cheerio = require('cheerio');
  5. var basicData = "# ALLOW TELNETINFO : no\n" +
  6.   "ALLOW WEBINFO : yes\n" +
  7.   "WEBINFO USERNAME : dusnoki\n" +
  8.   "WEBINFO PASSWORD : iPhoneguru88\n" +
  9.   "# TELNETINFO USERNAME : <username>\n" +
  10.   "# TELNETINFO PASSWORD : <password>\n" +
  11.   "# TELNETINFO LISTEN PORT : 16000\n" +
  12.   "WEBINFO LISTEN PORT : 16001\n" +
  13.   "# ZAP OSD TIME : 3\n" +
  14.   "# OSD USERNAME : root\n" +
  15.   "# OSD PASSWORD : dreambox\n" +
  16.   "# OSD PORT : 80\n" +
  17.   "# SERIAL READER : <device> <type>\n" +
  18.   "# SERIAL READER : /dev/tts/0\n" +
  19.   "# SMARTCARD WRITE DELAY : <device> <delay>\n" +
  20.   "# SMARTCARD WRITE DELAY : /dev/ttyUSB0 10000\n" +
  21.   "# SMARTCARD WRITE DELAY : /dev/tts/0_7 8000\n" +
  22.   "# SMARTCARD CLOCK FREQUENCY : <device> <freq>\n" +
  23.   "# SMARTCARD CLOCK FREQUENCY : /dev/ttyUSB0 5500000\n" +
  24.   "# SHOW TIMING : yes\n" +
  25.   "# MINI OSD : yes\n" +
  26.   "# DEBUG : yes\n" +
  27.   "# NEWCAMD CONF : yes\n" +
  28.   "# B : /dev/sci0 01\n" +
  29.   "# B : /dev/tts/0 07\n" +
  30.   "# B : /dev/sci0 01\n" +
  31.   "# DISABLE EMM : yes\n" +
  32.   "# GLOBAL EMM : 1\n" +
  33.   "# EXTRA EMM LEVEL : yes\n" +
  34.   "# EMM THREADS : 1\n" +
  35.   "# BOXKEY : <device> <byte1> <byte2> <byte3> <byte4>\n" +
  36.   "# BOXKEY : /dev/sci0 00 11 22 33\n" +
  37.   "# PIN : <device> <pin>\n" +
  38.   "# PIN : /dev/sci0 1234\n" +
  39.   "# CAMKEY : <device> <byte1> <byte2> <byte3> <byte4> <byte5> <byte6> <byte7> <byte8>\n" +
  40.   "# CAMKEY : /dev/sci0 11 22 33 44 55 66 77 88\n" +
  41.   "# CAMDATA : <device> <byte1> <byte2> <byte3> <byte4> <byte5> <byte6> ... <byte64>\n" +
  42.   "# CAMDATA : /dev/sci0 11 22 33 44 55 66 77 88 99 aa bb cc dd ee ff\n" +
  43.   "# BEEF ID : <ident1> <ident2> <ident3> <ident4> <ident5> <ident6> <ident7> <ident8> <device>\n" +
  44.   "# BEEF ID : 4101 0 0 0 0 0 0 0 /dev/sci0\n" +
  45.   "# SOFTKEY FILE : /var/keys/SoftCam.Key\n" +
  46.   "# AUTOROLL FILE : /var/keys/AutoRoll.Key\n" +
  47.   "# STATIC CW FILE : /var/keys/constant.cw\n" +
  48.   "# CAID PRIO FILE : /var/etc/CCcam.prio\n" +
  49.   "# PROVIDERINFO FILE : /var/etc/CCcam.providers\n" +
  50.   "# CHANNELINFO FILE : /var/etc/CCcam.channelinfo\n" +
  51.   "# LOG WARNINGS : /tmp/warnings.txt\n" +
  52.   "# NEWCAMD STEALTH : 0\n" +
  53.   "# LOADBALANCE : <device1> <device2> .. <devicen> { <exceptsid1>, <exceptsid2> .. , <exceptsidn> }\n" +
  54.   "# LOADBALANCE : /dev/ttyS0 /dev/ttyS1 /dev/ttyS2\n" +
  55.   "# LOADBALANCE : /dev/ttyS5 /dev/ttyS6 { 0df3,0de1 }\n" +
  56.   "# MINIMUM CLIENT VERSION : 1.3.0\n" +
  57.   "# MINIMUM CLIENT VERSION : 2.2.0\n" +
  58.   "# MINIMUM CLIENT VERSION : 1.7.0\n" +
  59.   "# TRY ALL CHIDS : <device>\n" +
  60.   "# TRY ALL CHIDS : /dev/ttyUSB0\n" +
  61.   "# DVB API : <value>\n" +
  62.   "# DVB API : -1\n" +
  63.   "# GLOBAL LIMITS : { caid:id(:downhops), caid:id(:downhops), ... }\n" +
  64.   "# GLOBAL LIMITS : { 0100:000080, 0622:000000:1, 0500:000000:2 }\n" +
  65.   "# MINIMUM DOWNHOPS : <value>\n" +
  66.   "# MINIMUM DOWNHOPS : 1\n" +
  67.   "# IGNORE NODE : <nodeid>\n" +
  68.   "# IGNORE NODE : ccd536ab515767ad\n" +
  69.   "# IGNORE NODE : aad536ab515761af\n" +
  70.   "# SECA HANDLER : <value>\n" +
  71.   "# SECA HANDLER : 1\n" +
  72.   "# SECA HANDLER : 2\n" +
  73.   "# SECA HANDLER : 3\n" +
  74.   "# SECA HANDLER : 4\n" +
  75.   "# SMARTCARD SID ASSIGN : <device> <maxnumberofsids> { <sid1>, <sid2>, ... <sidn> }\n" +
  76.   "# SMARTCARD SID ASSIGN : /dev/ttyUSB0 0 { 0df3,0df4,0df5 }\n" +
  77.   "# SMARTCARD SID ASSIGN : /dev/ttyUSB0 5\n" +
  78.   "# SMARTCARD SID ASSIGN : /dev/ttyUSB0 5 { 0df3,0df4,0df5 }\n" +
  79.   "# SMARTCARD SID REJECT : <device> { <sid1>, <sid2>, ... <sidn> }\n" +
  80.   "# SMARTCARD SID ASSIGN : /dev/ttyUSB0 { 0df3,0df4,0df5 }\n" +
  81.   "# SCIDEVICES : <number>\n" +
  82.   "# SCIDEVICES : 0\n" +
  83.   "# SCIDEVICES : 2"
  84.   var newData = "";
  85.  
  86. var c = new Client();
  87. c.on('ready', function() {
  88.  
  89.   c.cwd('etc', function(error) {
  90.     // c.list(function(err, list) {
  91.     //   if (err) throw err;
  92.     //   console.dir(list);
  93.     //   c.end();
  94.     // });
  95.     if (error) throw error;
  96.     c.get('CCcam.cfg', function(err, stream) {
  97.       if (err) throw err;
  98.       stream.pipe(fs.createWriteStream('temp/CCcam.cfg'));
  99.       var url = 'http://www.boss-cccam.com/Test.php';
  100.  
  101. // The structure of our request call
  102. // The first parameter is our URL
  103. // The callback function takes 3 parameters, an error, response status code and the html
  104.  
  105.       request(url, function(error, response, html){
  106.  
  107.         // First we'll check to make sure no errors occurred when making the request
  108.  
  109.         if(!error){
  110.           // Next, we'll utilize the cheerio library on the returned html which will essentially give us jQuery functionality
  111.  
  112.           var $ = cheerio.load(html);
  113.  
  114.           // Finally, we'll define the variables we're going to capture
  115.  
  116.           var cline;
  117.           $('.alert.alert-info').filter(function(){
  118.  
  119.             // Let's store the data we filter into a variable so we can easily see what's going on.
  120.  
  121.             var data = $(this);
  122.             // console.log("data", data.children().children().last().text);
  123.  
  124.             // In examining the DOM we notice that the title rests within the first child element of the header tag.
  125.             // Utilizing jQuery we can easily navigate and get the text by writing the following code:
  126.  
  127.             cline = data.children().first().children().first().text();
  128.             newData += cline + '\n';
  129.             console.log('newData', newData);
  130.             request("http://www.cccamlux.com/Free-CCcam.php", function(error1, response1, html1) {
  131.                 if (!error1) {
  132.                     var $1 = cheerio.load(html1);
  133.  
  134.                       // Finally, we'll define the variables we're going to capture
  135.  
  136.                   var cline2;
  137.                   $1('.alert.alert-warning').filter(function(){
  138.  
  139.                     // Let's store the data we filter into a variable so we can easily see what's going on.
  140.  
  141.                     var data1 = $(this);
  142.                     // console.log("data", data.children().children().last().text);
  143.  
  144.                     // In examining the DOM we notice that the title rests within the first child element of the header tag.
  145.                     // Utilizing jQuery we can easily navigate and get the text by writing the following code:
  146.  
  147.                     cline2 = data1.children().first().children().first().text();
  148.                     var array = cline2.split(" ");
  149.                    
  150.                     var server = array[1];
  151.                     var port = array[3];
  152.                     var user = array[5];
  153.                     var pass = array[7];
  154.                     var newCline = "C: " + server + " " + port + " " + user + " " + pass +"\n";
  155.                     newData += newCline;
  156.                    
  157.                      request("http://cccam-full.com/freecccam.php", function(error3, response3, html3){
  158.  
  159.                         // First we'll check to make sure no errors occurred when making the request
  160.  
  161.                         if(!error3){
  162.                           // Next, we'll utilize the cheerio library on the returned html which will essentially give us jQuery functionality
  163.  
  164.                           var $3 = cheerio.load(html3);
  165.  
  166.                           // Finally, we'll define the variables we're going to capture
  167.  
  168.                           var cline3;
  169.                           $3('.alert.alert-info').filter(function(){
  170.  
  171.                             // Let's store the data we filter into a variable so we can easily see what's going on.
  172.  
  173.                             var data3 = $3(this);
  174.                             // console.log("data", data.children().children().last().text);
  175.  
  176.                             // In examining the DOM we notice that the title rests within the first child element of the header tag.
  177.                             // Utilizing jQuery we can easily navigate and get the text by writing the following code:
  178.  
  179.                             cline3 = data3.children().first().children().first().text();
  180.                             newData += cline3 + '\n';
  181.                             // Once we have our title, we'll store it to the our json object.
  182.                             console.log(newData);
  183.                             fs.writeFile('temp/CCcam.cfg', newData+basicData, function (err) {
  184.                               console.log("written data");
  185.                               if (err) throw err;
  186.                               c.put('temp/CCcam.cfg', 'CCcam.cfg', function(err) {
  187.                                 if (err) throw err;
  188.                                 console.log('Uploaded data');
  189.                                 c.end();
  190.                               });
  191.                             })
  192.                           });
  193.                      }});
  194.                   })
  195.                 }
  196.             });
  197.           })
  198.         }
  199.       });
  200.     });
  201.   });
  202.  
  203. });
  204. // connect to localhost:21 as anonymous
  205. c.connect({host: '192.168.1.2', user: 'root', password: 'reamboxDguru88'});
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement