Skip to content

Instantly share code, notes, and snippets.

View oscarandreu's full-sized avatar
💭
At work

Óscar Andreu oscarandreu

💭
At work
View GitHub Profile
@oscarandreu
oscarandreu / ISP_template.py
Last active August 20, 2022 18:18 — forked from mattyb149/ISP_template.py
An Apache NiFi InvokeScriptedProcessor template (in Jython) for running ExecuteScript Jython scripts faster
from org.apache.nifi.processor import Processor,Relationship
from org.apache.nifi.components import PropertyDescriptor
from org.apache.nifi.processor.util import StandardValidators
from java.lang import Throwable
class ScriptBody():
def __init__(self):
pass
def executeScript(self, session, context, log, REL_SUCCESS, REL_FAILURE):
flowFile = session.get()
@oscarandreu
oscarandreu / brackets_pattern
Last active August 3, 2018 08:20
Telegraf configuration to parse NiFi logs (nifi-app)
NIFI_TASK \[%{GREEDYDATA:NifiTask} %{NOTSPACE:Thread}\]
@oscarandreu
oscarandreu / elkinstall.sh
Last active August 9, 2018 10:32 — forked from mandeepbal/elkinstall.sh
ELK install
# https://www.elastic.co/guide/en/elasticsearch/reference/current/_installation.htmlhttps://www.elastic.co/guide/en/elasticsearch/reference/current/_installation.html
##############################################
#
# ELK Server
#
##############################################
yum install -y java
rpm --import http://packages.elasticsearch.org/GPG-KEY-elasticsearch
@oscarandreu
oscarandreu / dict_to_obj.py
Created July 20, 2018 05:38
Python3 dictionary to object
class Struct(object):
def __init__(self, data):
for name, value in data.items():
setattr(self, name, self._wrap(value))
def _wrap(self, value):
if isinstance(value, (tuple, list, set, frozenset)):
return type(value)([self._wrap(v) for v in value])
else:
return Struct(value) if isinstance(value, dict) else value
@oscarandreu
oscarandreu / dirtycow.txt
Created February 20, 2018 11:51
Dirty Cow POC
/*
* (un)comment correct payload first (x86 or x64)!
*
* $ gcc cowroot.c -o cowroot -pthread
* $ ./cowroot
* DirtyCow root privilege escalation
* Backing up /usr/bin/passwd.. to /tmp/bak
* Size of binary: 57048
* Racing, this may take a while..
* /usr/bin/passwd overwritten
@oscarandreu
oscarandreu / PowerShell modify file name with pattern.ps1
Created February 14, 2018 13:18
PowerShell modify file name with pattern
Get-ChildItem -filter '*_COLOR.svg' |
ForEach-Object {
$name = $_.Name -Replace '_COLOR', ''
$name.ToString();
Remove-Item $name
Rename-Item $_.Name -NewName $name;
}
Get-ChildItem -filter '*-color.svg' |
@oscarandreu
oscarandreu / Ubuntu install guess additions
Created December 17, 2017 20:38
Ubuntu install guess additions
sudo apt-get install virtualbox-guest-additions-iso
cd /usr/share/virtualbox
sudo mkdir /mnt/guessadd
sudo mount -o loop VBoxGuestAdditions.iso /mnt/guessadd
sudo /mnt/guessadd/VBoxLinuxAdditions.run
sudo umount /mnt/guessadd
sudo rm -rf /mnt/guessadd
@oscarandreu
oscarandreu / windows_folder_permissions
Created October 11, 2017 14:40
Change windows folder permissions
Icacls C:\Dev /inheritance:e /grant:r "IUSR":(OI)(CI)F /grant:r "IIS_IUSRS":(OI)(CI)F
@oscarandreu
oscarandreu / git clone local certificate
Created September 12, 2017 11:52
git clone local certificate
git -c http.sslVerify=false clone https://tfs.rmi.tec.dom:444/tfs/DefaultCollection/yyyyy/_git/xxxxxxxxx
@oscarandreu
oscarandreu / AIQL statistics per country.txt
Last active September 7, 2017 15:16
AIQL statistics per country
let agregationInterval = 1h;
let StartTime = datetime("2017-08-01");
let EndTime = datetime("2017-08-31");
let ips = dynamic(['2.139.214.0', '::1', '0.0.0.0', '127.0.0.0']);
let resultCodes = dynamic(['402']);
let filteredRequests = requests
| where timestamp >= StartTime and timestamp < EndTime and resultCode !in (resultCodes) and client_IP !in (ips) and client_CountryOrRegion != ''
| summarize req = count() by client_IP,client_CountryOrRegion, timestamp;
filteredRequests
| summarize sum=sum(req), avg=avg(req), stdev=stdev(req) by client_CountryOrRegion