src/search.js
function search(platform) {
  return new Promise((resolve, reject) => {
    if (!platform || platform === '') reject(new Error('platform cannot be blank'));
    const options = {
      method: 'GET',
      hostname: 'www.exploitalert.com',
      path: `/api/search-exploit?name=${platform}`,
    };

    const req = http.request(options, (res) => {
      const chunks = [];

      res.on('data', (chunk) => {
        chunks.push(chunk);
      });

      res.on('end', () => {
        const body = Buffer.concat(chunks);
        resolve(JSON.parse(body));
      });
    });

    req.on('error', err => reject(err));
    req.end();
  });
}
function search(platform) {
  return new Promise((resolve, reject) => {
    if (!platform || platform === '') reject(new Error('platform cannot be blank'));
    const options = {
      method: 'GET',
      hostname: 'www.exploitalert.com',
      path: `/api/search-exploit?name=${platform}`,
    };

    const req = http.request(options, (res) => {
      const chunks = [];

      res.on('data', (chunk) => {
        chunks.push(chunk);
      });

      res.on('end', () => {
        const body = Buffer.concat(chunks);
        resolve(JSON.parse(body));
      });
    });

    req.on('error', err => reject(err));
    req.end();
  });
}
function search ( platform ) { return new Promise ( ( resolve , reject ) => { if ( ! platform || platform === '' ) reject ( new Error ( 'platform cannot be blank' ) ) ; const options = { method : 'GET' , hostname : 'www.exploitalert.com' , path : ` ${ platform } ` , } ; const req = http . request ( options , ( res ) => { const chunks = [ ] ; res . on ( 'data' , ( chunk ) => { chunks . push ( chunk ) ; } ) ; res . on ( 'end' , ( ) => { const body = Buffer . concat ( chunks ) ; resolve ( JSON . parse ( body ) ) ; } ) ; } ) ; req . on ( 'error' , err => reject ( err ) ) ; req . end ( ) ; } ) ; }
Searches exploitalert db
@param {string} platform - the platform to search for
Searches exploitalert db