Skip to content

Instantly share code, notes, and snippets.

Avatar
👋
Hi

Mertcan GÖKGÖZ mertcangokgoz

👋
Hi
View GitHub Profile
@mertcangokgoz
mertcangokgoz / center.py
Created November 12, 2022 09:23
Center Terminal Output
View center.py
import os
def center_terminal_output(var: str, space: int = None) -> str:
if not space:
space = (os.get_terminal_size().columns - len(var.splitlines()[len(var.splitlines()) // 2])) / 2
return "\n".join(" " * space + var for var in var.splitlines())
View justpaste_sniffer.py
import string
import time
import warnings
from pathlib import Path
from random import SystemRandom
import requests # pip install requests
import requests_random_user_agent # noqa: F401 # pip install requests-random-user-agent
from urllib3.exceptions import InsecureRequestWarning
@mertcangokgoz
mertcangokgoz / spf_check.py
Created August 31, 2022 03:12
Simple SPF Checker via dnspython
View spf_check.py
import dns.resolver # pip install dnspython
class SpfCheck:
def __init__(self, domain: str) -> None:
self.domain = domain
self.spf_record = self.get_spf_record(domain)
self.parsed_spf = self.get_assets(self.spf_record)
self.ip_address = self.enumerate_ips(self.spf_record)
@mertcangokgoz
mertcangokgoz / taxpayer_check.py
Last active November 12, 2022 09:37
Taxpayer checker via tesseract-ocr
View taxpayer_check.py
import os
import shutil
import uuid
import pytesseract # pip install pytesseract and https://tesseract-ocr.github.io/tessdoc/Home.html
import requests # pip install requests
from PIL import Image # pip install pillow
from bs4 import BeautifulSoup # pip install beautifulsoup4
# Create a requests session
@mertcangokgoz
mertcangokgoz / detect_encodings.py
Created August 31, 2022 03:00
character encoding detection via chardet
View detect_encodings.py
import logging
from collections import namedtuple
from chardet import UniversalDetector # pip install chardet
logger = logging.getLogger(__name__)
Guess = namedtuple("Guess", ["encoding", "confidence"])
@mertcangokgoz
mertcangokgoz / benchmark
Created August 30, 2022 23:09
Ilkbyte Cloud [4 Core / 8 GB / 80 GB Disk] Benchmark Result
View benchmark
root@debian:~# curl -sL yabs.sh | bash
# ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## #
# Yet-Another-Bench-Script #
# v2022-08-20 #
# https://github.com/masonr/yet-another-bench-script #
# ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## #
Wed 31 Aug 2022 01:50:51 AM +03
Basic System Information:
@mertcangokgoz
mertcangokgoz / docker_cli.md
Created February 13, 2022 11:22
Docker CLI ve Docker Compose Notlarım
View docker_cli.md

Docker CLI

docker build -t name .
docker run -p 8080:80 name 
docker run -d -p 8080:80 name 
docker exec -it [id] bash
docker ps 
docker stop <id>
docker ps -a
@mertcangokgoz
mertcangokgoz / aws_cli.md
Created February 12, 2022 18:48
Amazon AWS CLI Notlarım
View aws_cli.md

EC2

aws ec2 describe-instances
aws ec2 describe-instances --instance-ids <instance1> <instance2>
aws ec2 describe-instances --filters Name=<instance_name>

aws ec2 start-instances --instance-ids <instance1> <instance2>
aws ec2 stop-instances --instance-ids <instance1> <instance2>
aws ec2 terminate-instances --instance-ids  
View cloudflare-scrape.py
import requests
from requests.adapters import HTTPAdapter
from urllib3.util.retry import Retry
from random_useragent import random_useragent
class RequestsHelper(object):
"""HTTP Request helper"""
def __init__(self):
View RDP-Audit.ps1
Get-EventLog -LogName Security -after (Get-date -hour 0 -minute 0 -second 0) | Where-Object { (4624, 4778) -contains $_.EventID -and $_.Message -match 'logon type:\s+(10)\s' } | % {
(new-object -Type PSObject -Property @{
TimeGenerated = $_.TimeGenerated
ClientIP = $_.Message -replace '(?smi).*Source Network Address:\s+([^\s]+)\s+.*', '$1'
UserName = $_.Message -replace '(?smi).*Account Name:\s+([^\s]+)\s+.*', '$1'
UserDomain = $_.Message -replace '(?smi).*Account Domain:\s+([^\s]+)\s+.*', '$1'
LogonType = $_.Message -replace '(?smi).*Logon Type:\s+([^\s]+)\s+.*', '$1'
})
} | Sort-Object TimeGenerated -Descending | Select-Object TimeGenerated, ClientIP `
, @{N = 'Username'; E = { '{0}\{1}' -f $_.UserDomain, $_.UserName } } `