Skip to content

Instantly share code, notes, and snippets.

@tristandostaler
tristandostaler / countIP.sh
Created Jul 8, 2016
script to count the number of occurence of an IP in the logs (used with a router)
View countIP.sh
#/bin/sh
sudo grep "SRC=" /var/log/kern.log |awk '{print $10}' | sort | uniq -c |sort -n |sed 's/SRC=//g' | sed 's/DST//g' | sed 's/DS//g' | sed 's/D//g' $
@tristandostaler
tristandostaler / blockIP.sh
Created Jul 8, 2016
Script to block ip in IP tables.
View blockIP.sh
#!/bin/sh
if [ "$#" -ne 1 ]; then
echo "Usage: $0 IP (ex: $0 192.168.0.1)" >&2
exit 1
fi
sudo iptables -I INPUT 2 -s $1 -j DROP
sudo iptables -I FORWARD 2 -s $1 -j DROP
@tristandostaler
tristandostaler / StartSelenium.sh
Created Jul 7, 2016
Start Selenium with ipython from StartSelenium.py script with interactive mode
View StartSelenium.sh
ipython -i StartSelenium.py
@tristandostaler
tristandostaler / StartSelenium.py
Created Jul 7, 2016
Start Selenium python script
View StartSelenium.py
browser = None
def StartSelenium():
import selenium
from selenium import webdriver
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities
import binascii
import hashlib
firefox_capabilities = DesiredCapabilities.FIREFOX
firefox_capabilities['marionette'] = True
firefox_capabilities['binary'] = '/usr/bin/firefox'
@tristandostaler
tristandostaler / InstallSelenium.sh
Created Jul 7, 2016
How to install correctly python Selenium (tested on ubuntu gnome)
View InstallSelenium.sh
apt-get install ipython
apt-get install python-pip
pip install selenium
mkdir /root/bin
cd /root/bin
wget https://github.com/mozilla/geckodriver/releases/download/v0.9.0/geckodriver-v0.9.0-linux64.tar.gz
tar -xvzf geckodriver-v0.9.0-linux64.tar.gz
rm geckodriver-v0.9.0-linux64.tar.gz
chmod +x geckodriver
cp geckodriver wires
View stacktrace
Initial SessionFactory creation failed.org.hibernate.MappingException: Could not get constructor for org.hibernate.persister.entity.SingleTableEntityPersister
oct. 15, 2015 11:46:33 AM org.apache.catalina.core.StandardWrapperValve invoke
GRAVE: Servlet.service() for servlet [action] in context with path [/LOG660-E3-LA2] threw exception [L''exécution de la servlet a lancé une exception] with root cause
java.lang.NullPointerException
at ca.etsmtl.log660.bean.Adresse.getId(Adresse.java:26)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.hibernate.property.BasicPropertyAccessor$BasicGetter.get(BasicPropertyAccessor.java:164)