src/details.js
function details(id) {
  return new Promise((resolve, reject) => {
    if (!id || id === '') throw new Error('id cannot be blank');

    const options = {
      method: 'GET',
      hostname: 'www.exploitalert.com',
      port: null,
      path: `/view-details.html?id=${id}`,
      headers: {},
    };

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

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

      res.on('end', () => {
        const body = Buffer.concat(chunks);
        resolve(body.toString());
      });
    });
    req.on('error', reject);
    req.end();
  })
    .then((html) => {
      const $ = cheerio.load(html);
      return $('pre').text();
    })
    .catch(err => err);
}
function details(id) {
  return new Promise((resolve, reject) => {
    if (!id || id === '') throw new Error('id cannot be blank');

    const options = {
      method: 'GET',
      hostname: 'www.exploitalert.com',
      port: null,
      path: `/view-details.html?id=${id}`,
      headers: {},
    };

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

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

      res.on('end', () => {
        const body = Buffer.concat(chunks);
        resolve(body.toString());
      });
    });
    req.on('error', reject);
    req.end();
  })
    .then((html) => {
      const $ = cheerio.load(html);
      return $('pre').text();
    })
    .catch(err => err);
}
function details ( id ) { return new Promise ( ( resolve , reject ) => { if ( ! id || id === '' ) throw new Error ( 'id cannot be blank' ) ; const options = { method : 'GET' , hostname : 'www.exploitalert.com' , port : null , path : ` ${ id } ` , headers : { } , } ; const req = http . request ( options , ( res ) => { const chunks = [ ] ; res . on ( 'data' , ( chunk ) => { chunks . push ( chunk ) ; } ) ; res . on ( 'end' , ( ) => { const body = Buffer . concat ( chunks ) ; resolve ( body . toString ( ) ) ; } ) ; } ) ; req . on ( 'error' , reject ) ; req . end ( ) ; } ) . then ( ( html ) => { const $ = cheerio . load ( html ) ; return $ ( 'pre' ) . text ( ) ; } ) . catch ( err => err ) ; }
Get details of an exploit
@param {string} id - id of the exploit
Get details of an exploit