How to run scapy after installing - packet-sniffers

I have installed scapy using the command pip install scapy on my ubuntu terminal. I also have Python 2.7.17 installed. How do I run scapy in the ubuntu terminal? I have tried running the command: sudo ./scapy. My goal is to use scapy to sniff packets and record sending and receiving time of packets.

You can do
python -m scapy
to start the scapy module (-m) as a CLI tool

scapy is not an executable. Its a library used in python wich can be imported into python code:
import scapy.all as scapy
Then you can call scapy.ARP, scapy.Ether or layers/fields like in your code.
If you want to sniff for information from web for example, you need to inport layers too:
from scapy.layers import http
then you can search and filter using http.HTTPRequest:
if packet.haslayer(http.HTTPRequest):
print(packet.show())
to get an idea what fields you wnat to fetch, ex load from scapy.Raw:
packet[scapy.Raw].load
See documentation: https://scapy.readthedocs.io/en/latest/layers/http.html

Related

Install psutil on MobaXterm

I'm working on MobaXterm and need a python library (prefect) requiring psutil. When I run pip3 install psutil I get the following error : platform cygwin is not supported
Then pip loops on older verisons of psutil repeating the same errors again.
How can install psutil on MobaXterm ?
I can't consider installing Linux on my computer for now, although an alternative to MobaXterm could if it's the only solution.
You can try installing Linux subsystem for windows: https://learn.microsoft.com/en-us/windows/wsl/install
You can use it as a replacemento to connect to remote machine ( that is what I guess you are using MobaXTerm ) and having a working linux environment.

Install chromedriver on Mac M1 at specific location?

I just made the jump from Ubuntu to MacBook Air M1.
I am trying to set-up the system in a way that I don't have to change scripts for both. i.e. I want to keep the scripts in such a way that editing on either system is ok.
In a script I use the following line of code:
driver = webdriver.Chrome("/usr/lib/chromium-browser/chromedriver")
I used Homebrew to install chromium-browser but I can't find the file (so I can move it to this location?).
I have tried almost everything I could look up and can't figure it out. What can I try next?
Install webdriver-manager, it allows you install and store chromedrive automatically
pip install webdriver-manager
and use like this:
from selenium import webdriver
from webdriver_manager.chrome import ChromeDriverManager
driver = webdriver.Chrome(ChromeDriverManager().install())
The fastest way to to solve is using Home Brew:
brew install --cask chromedriver
Chromedriver will be installed in the correct path.
You can find the downloads for various versions of the Chrome driver here: https://chromedriver.chromium.org/downloads
For example, for v99 on Mac M1 you could download this archive: https://chromedriver.storage.googleapis.com/99.0.4844.51/chromedriver_mac64_m1.zip
Once downloaded just unzip & copy to whatever location you choose. After I installed I still needed to mark the application as "safe" in macOS, I followed the instructions here: https://stackoverflow.com/a/60362134/1371489

Can I use pydap.client in windows?

I tried to use pydap.client to access netcdf data from thredds server on a windows PC. I installed pydap using conda conda install -c conda-forge pydap=3.2.0.
When I run the code
from pydap.client import open_url
I get the following error message
pkg_resources.DistributionNotFound: The 'gunicorn' distribution was not found and is required by the application
I tried to install gunicorn, However, gunicorn is not available for Windows.
Can't I use pydap.client in Windows?

How to download files from a python program

I'm trying to make a minecraft installer program in python.
currently, I've got a bash script I call with subprocess to download the files with wget, but that only works on linux.
is there a platform-independant python library for downloading files?
thanks,
martin
There is a lot of python library which can do that: urllib, urllib2, requests.
For instance with requests:
import requests
response = requests.get('http://www.example.com/file')
You may need to install requests with pip or your package manager. Using pip:
pip install requests

How to install Logstash for NodeJs on Windows 7

I want to install Logstash for NodeJs on windows 7, but I am not able to find proper steps for the same.
Can any one please help!
There is the option of node-logstash if you want a node.js alternative to Logstash. This isn't something I'm using myself (I'm using nxlog in Windows instead) but it looks like a decent alternative to the standard JRuby Logstash if you need to forward logs from Windows.
Instructions from the readme are below:
Installation
Install NodeJS, version >= 0.10, or io.js.
Install build tools
Debian based system: apt-get install build-essential
Centos system: yum install gcc gcc-c++ make
Install zmq dev libraries: This is required to build the node zeromq module.
Debian based system: apt-get install libzmq1. Under recent releases, this package is present in default repositories. On ubuntu lucid, use this ppa. On debian squeeze, use backports.
Centos 6: yum install zeromq zeromq-devel. Before, you have to add the rpm zeromq repo : curl http://download.opensuse.org/repositories/home:/fengshuo:/zeromq/CentOS_CentOS-6/home:fengshuo:zeromq.repo > /etc/yum.repos.d/zeromq.repo
Clone repository: git clone git://github.com/bpaquet/node-logstash.git && cd node-logstash
Install dependencies: npm install.
The executable is in bin/node-logstash-agent
You have scripts in dists folder to build packages. Actually, only debian is supported.
As per the comment, logstash has nothing to do with nodejs.
What you're looking to do is install Logstash on Windows, something that you can find out about by using google, there will be loads of guides out there describing how to do this.
You would then need to configure logstash to look in the right location for the log files it needs to process, and then set up filters to handle nodejs style logs (which as far as I understand aren't very well standardised). You then need to configure an output (logstash is essentially a unix pipe on steroids and needs somewhere to save the logs it has processed). Elasticsearch is the most common thing to save logs to.
Personally, in my environment, I would install logstash on a CentOS server, as it's a well established process, and ship the logs from your Windows 7 machine to the logstash server using either logstash forwarder or nxlog. That way you can have logs coming in from a number of different sources and you can still reboot your Windows machine every few days as required by Windows update without your logstash server going down.

Resources