Skip to content

Instantly share code, notes, and snippets.

View SyeedHasan's full-sized avatar
🖥️
Let's get it!

Hasan SyeedHasan

🖥️
Let's get it!
View GitHub Profile
@SyeedHasan
SyeedHasan / SessionDocumentforSSM.json
Created June 19, 2022 11:48
Sample document for AWS Session Manager preferences
{
"schemaVersion": "1.0",
"description": "Document to hold regional settings for Session Manager",
"sessionType": "Standard_Stream",
"inputs": {
"s3BucketName": "DOC-EXAMPLE-BUCKET",
"s3KeyPrefix": "MyBucketPrefix",
"s3EncryptionEnabled": true,
"cloudWatchLogGroupName": "MyLogGroupName",
"cloudWatchEncryptionEnabled": true,
@SyeedHasan
SyeedHasan / SessionManagerRole.json
Created June 19, 2022 08:41
Policy for permissions to SSM, KMS, and Amazon S3
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"ssmmessages:CreateControlChannel",
"ssmmessages:CreateDataChannel",
"ssmmessages:OpenControlChannel",
"ssmmessages:OpenDataChannel",
@SyeedHasan
SyeedHasan / MemoryAcquisitionUNIX.md
Last active February 12, 2024 16:22
Commands to acquire a snapshot of the memory on *UNIX based systems

Generic Commands

Checking Kernel release: uname -r

Checking Kernel version: uname -v

Commands to Acquire Memory

Here's a list of commands which you may execute to acquire memory from a *UNIX system:\


@SyeedHasan
SyeedHasan / pcap(ng)-shortcuts.md
Last active February 16, 2022 04:22
PCAP mumbo-jumbo

Splitting a PCAP

To divide a PCAP into chunks of 200MB:
tcpdump -r inputPcap.pcap -w outputPcap.pcap -C 200

Wireshark Helpers

capinfos.exe: This prints information about trace files
dumpcap.exe: This captures packets and saves to a libpcap format file
editcap.exe: This splits a trace file, alters timestamps, and removes duplicate packets
mergecap.exe: This merges two or more packet files into one file
rawshark.exe: This reads a stream of packets and prints field descriptions\

@SyeedHasan
SyeedHasan / x509-certificates.md
Last active February 16, 2022 04:23
Managing X509 certificates - creation, conversion, etc.

Acquiring TLS Certificates from Shodan

  1. Head to the Raw Version of the report
  2. Go to the SSL section
    2A. Use the 'cert' section to retrieve fingerprints of the certificate (SHA1/MD5 of the certificate in DER format)
    2B. Use the 'chain' section to retrieve the certificate in PEM (might require some form of cleaning before its usable)

Creation of an X509 Certificate

openssl req -newkey rsa:2048 -nodes -keyout key.pem -x509 -days 365 -out certificate.pem

Decode Certificate to Text

@SyeedHasan
SyeedHasan / Winlogbeat Configuration.md
Last active May 29, 2021 17:28
Winlogbeat tweaks

Winlogbeat Custom Template Naming

Steps

  1. Update the 'index' field in output.elasticsearch [e.g. win-host-%{yyyy-mm-dd}]
  2. Update the 'setup.template.name' and 'setup.template.pattern' accordingly [e.g., win- and win-*]
  3. Disable ILM because custom template naming won't work if this is enabled i.e., setup.ilm.enabled: false
  4. Load the custom template: .\winlogbeat.exe setup --index-management -E output.logstash.enabled=false -E 'output.elasticsearch.hosts=["192.168.18.110:1337"]'
  5. Restart the winlogbeat service
@SyeedHasan
SyeedHasan / mount-problems.md
Last active May 18, 2021 17:13
Mounting Shared Folders
@SyeedHasan
SyeedHasan / Github Flavored Markdown.md
Last active October 5, 2021 09:36 — forked from stevenyap/Github Flavored Markdown.md
Github Flavored Markdown cheatsheet

Github Flavored Markdown (GFMD) is based on Markdown Syntax Guide with some overwriting as described at Github Flavored Markdown

Text Writing

It is easy to write in GFMD. Just write simply like text and use the below simple "tagging" to mark the text and you are good to go!

To specify a paragraph, leave 2 spaces at the end of the line

Headings

@SyeedHasan
SyeedHasan / elk-ip-corruption.md
Last active May 24, 2021 06:37
ELK - Importing Saved Objects

Importing Dashboards in ELK

  1. Visit 'Stack Management'
  2. Head to 'Saved Objects'
  3. Import the NDJSON file for the objects/dashboard you wish to add
  4. Confirm the import

'Requested Entity Too Large' During Imports

Max upload size is restricted in Kibana or a reverse proxy (if you have any). Head to Kibana's configuration and increase the 'maxPayloadSize' key to a larger value. Similarly, if you use Nginx, add the following line to your configuration file to increase the max body size:

@SyeedHasan
SyeedHasan / parseml.py
Created November 11, 2020 17:05 — forked from urschrei/parseml.py
Extract attachments from EML files in the current dir, and write them to the output subdir
#!/usr/bin/env python
"""
2020 update:
- More iterators, fewer lists
- Python 3 compatible
- Processes files in parallel
(one thread per CPU, but that's not really how it works)
"""