Bin Sniffer

Sniffs url and returns *.bin file links.
 avatar
user_8806294
actionscript
2 years ago
1.2 kB
1
Indexable
Never
import React, { useState, useEffect } from 'react';
import axios from 'axios';

function BinFileSniffer() {
  const [url, setUrl] = useState('');
  const [binFileLinks, setBinFileLinks] = useState([]);

  useEffect(() => {
    async function fetchData() {
      const response = await axios.get(url);
      const soup = BeautifulSoup(response.data, 'html.parser');
      const links = [];
      for (let link of soup.find_all("a")) {
        let href = link.get("href");
        if (href.endsWith(".bin")) {
          links.push(href);
        }
      }
      setBinFileLinks(links);
    }
    fetchData();
  }, [url]);

  return (
    <div>
      <input 
        type="text" 
        value={url} 
        onChange={(e) => setUrl(e.target.value)} 
        placeholder="Enter a website URL" 
      />
      <br />
      <button onClick={() => fetchData()}>Fetch Bin files</button>
      <br />
      {binFileLinks.length > 0 ? (
        <ul>
          {binFileLinks.map((link) => (
            <li key={link}>{link}</li>
          ))}
        </ul>
      ) : (
        <p>No bin files found</p>
      )}
    </div>
  );
}

export default BinFileSniffer;