Skip to content

Instantly share code, notes, and snippets.

View sengupta-saikat's full-sized avatar
🏠
Working from home

Saikat sengupta-saikat

🏠
Working from home
View GitHub Profile
@sengupta-saikat
sengupta-saikat / read.md
Created April 9, 2024 17:40
curl: (58) unable to set private key file

If you see an error saying curl: (58) unable to set private key file there is a chance that the private key in your PEM file does not match the certificate. You can check this by comparing the modulus of the certificate and the private key. Here’s how you can do it:

openssl x509 -noout -modulus -in certificate.pem | openssl md5
openssl rsa -noout -modulus -in private_key.pem | openssl md5
@sengupta-saikat
sengupta-saikat / conn_test.py
Created October 18, 2023 15:26
Test the connectivity
import socket
def check_conn():
conn_data = [
('xyz.abc.int', '10.20.200.10', 443),
('abc.xyz.int', '10.20.200.12', 8080)
]
for name, host, port in conn_data:
@sengupta-saikat
sengupta-saikat / pfx.md
Created August 21, 2023 05:05
Extract Cert and Key from PFX
  • Extract the CA certs only: openssl pkcs12 -in mtf.pfx -out ca_certs.pem -cacerts -nokeys

  • Extract the Client certs only: openssl pkcs12 -in mtf.pfx -out client_certs.pem -clcerts -nokeys

  • Extract Private Key Only: openssl pkcs12 -in mtf.pfx -nocerts -out private.key -nodes

@sengupta-saikat
sengupta-saikat / template.sh
Created October 27, 2022 15:59
bash script template
#!/usr/bin/env bash
# ref - https://sharats.me/posts/shell-script-best-practices/
set -o errexit
set -o nounset
set -o pipefail
if [[ "${TRACE-0}" == "1" ]]; then
set -o xtrace
fi
@sengupta-saikat
sengupta-saikat / Domain Enumeration Commands
Created October 9, 2020 08:11 — forked from its-a-feature/Domain Enumeration Commands
Common Domain Enumeration commands in Windows, Mac, and LDAP
Domain: TEST.local
User Enumeration:
Windows:
net user
net user /domain
net user [username]
net user [username] /domain
wmic useraccount
Mac:
dscl . ls /Users
@sengupta-saikat
sengupta-saikat / index.html
Created August 9, 2020 09:16
form-jquery
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<link rel="stylesheet" href="https://unpkg.com/[email protected]/build/pure-min.css"
integrity="sha384-cg6SkqEOCV1NbJoCu11+bm0NvBRc8IYLRGXkmNrqUBfTjmMYwNKPWBTIKyw9mHNJ" crossorigin="anonymous">
@sengupta-saikat
sengupta-saikat / TestCafeAssertions.js
Last active January 19, 2020 14:47
TestCafe Assertions
import { Selector } from 'testcafe';
fixture `Getting Started`
.page `https://news.ycombinator.com/`;
/**
* Docs: https://devexpress.github.io/testcafe/documentation/test-api/assertions/assertion-api.html
* Signature: await t.expect( actual ).eql( expected, message, options );
*
*/
@sengupta-saikat
sengupta-saikat / windows-app-installs.bat
Last active March 24, 2019 13:22
admin powershell script to install all my apps using chocolatey after a fresh OS installation
REM script to install all required apps post fresh OS installation
Set-ExecutionPolicy Bypass -Scope Process -Force; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
choco -?
choco feature enable -n allowGlobalConfirmation
choco install 7zip
choco install jdk8
choco install groovy
choco install maven
choco install python
choco install cmdermini
def getProjectName() {
return 'JenkinsPipeline'
}
def getJDKVersion() {
return 'jdk1.8.0_101'
}
def getMavenConfig() {
return 'maven-config'
@sengupta-saikat
sengupta-saikat / CsvToJson.java
Created January 20, 2019 08:22
Converts multiple csv files in a singe json file
package com.sai;
import com.google.common.collect.MultimapBuilder;
import com.google.common.collect.SetMultimap;
import com.google.gson.GsonBuilder;
import org.apache.commons.csv.CSVFormat;
import org.apache.commons.csv.CSVParser;
import org.apache.commons.csv.CSVRecord;
import java.io.File;