Skip to content
Snippets Groups Projects
Commit 6885bccb authored by Peter van der Velde's avatar Peter van der Velde
Browse files

Initial commit

parents
No related branches found
No related tags found
No related merge requests found
Pipeline #47029 failed
<br />
<div align="center">
<a href="">
<h3 align="center">ESA Assignment III</h3>
</a>
<p align="center">
Analysing the state of DNSSEC and DNS-based security mechanisms.
</p>
</div>
<!-- TABLE OF CONTENTS -->
<details>
<summary>Table of Contents</summary>
<ol>
<li>
<a href="#about-the-project">About The Project</a>
</li>
<li>
<a href="#getting-started">Getting Started</a>
<ul>
<li><a href="#prerequisites">Prerequisites</a></li>
<li><a href="#installation">Installation</a></li>
</ul>
</li>
<li><a href="#roadmap">Roadmap</a></li>
</ol>
</details>
## About The Project
In this assignment, we wrote a TLS/X.509 scanner from scratch.
<p align="right">(<a href="#readme-top">back to top</a>)</p>
## Getting Started
### Prerequisites
A few programs are needed before the installation and use of the python scripts.
* pip
```sh
sudo apt install -y python3-pip
```
### Installation
1. Clone the repo
```sh
git clone https://gitlab.utwente.nl/s2589834/esa-assignment-iii.git
```
2. Install all required libraries
```sh
python3 -m pi3p install --user -r requirements.txt
```
### Run Program
For more information run the program with the help flag (-h or --help).
1. Running the scanner
```sh
./scanner.py -i <input_file> -o <log_file> -c <root_certs.pem> -b <block_list> --no-crash
```
2. Running the analysis code
```sh
./analysis.py -i <log_file>
```
<p align="right">(<a href="#readme-top">back to top</a>)</p>
pycrypto
\ No newline at end of file
#!/bin/env python3
# Found on https://stackoverflow.com/questions/12911373/how-do-i-use-a-x509-certificate-with-pycrypto
# Needs pycrypto
from Crypto.Util.asn1 import DerSequence
from Crypto.PublicKey import RSA
from binascii import a2b_base64
# Convert from PEM to DER
pem = open("mycert.pem").read()
lines = pem.replace(" ",'').split()
der = a2b_base64(''.join(lines[1:-1]))
# Extract subjectPublicKeyInfo field from X.509 certificate (see RFC3280)
cert = DerSequence()
cert.decode(der)
tbsCertificate = DerSequence()
tbsCertificate.decode(cert[0])
subjectPublicKeyInfo = tbsCertificate[6]
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment