Skip to content
This repository was archived by the owner on Jul 30, 2021. It is now read-only.

Commit ebeab8a

Browse files
committed
initial release
0 parents  commit ebeab8a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

65 files changed

+7181
-0
lines changed

.editorconfig

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# EditorConfig: https://EditorConfig.org
2+
3+
# top-most EditorConfig file
4+
root = true
5+
6+
# Unix-style newlines with a newline ending every file
7+
[*]
8+
end_of_line = lf
9+
insert_final_newline = true
10+
11+
# ruby
12+
[*.rb]
13+
charset = utf-8
14+
indent_style = space
15+
indent_size = 2
16+
trim_trailing_whitespace = true

.github/workflows/ruby.yml

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# This workflow uses actions that are not certified by GitHub.
2+
# They are provided by a third-party and are governed by
3+
# separate terms of service, privacy policy, and support
4+
# documentation.
5+
# This workflow will download a prebuilt Ruby version, install dependencies and run tests with Rake
6+
# For more information see: https://github.com/marketplace/actions/setup-ruby-jruby-and-truffleruby
7+
8+
name: Ruby
9+
10+
on:
11+
push:
12+
branches: [ master ]
13+
pull_request:
14+
branches: [ master ]
15+
16+
jobs:
17+
test:
18+
19+
runs-on: ubuntu-latest
20+
strategy:
21+
matrix:
22+
ruby-version: ['3.0', '2.7', '2.6']
23+
24+
steps:
25+
- uses: actions/checkout@v2
26+
- name: Set up Ruby
27+
# To automatically get bug fixes and new Ruby versions for ruby/setup-ruby,
28+
# change this to (see https://github.com/ruby/setup-ruby#versioning):
29+
uses: ruby/setup-ruby@v1
30+
with:
31+
ruby-version: ${{ matrix.ruby-version }}
32+
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
33+
- name: Run lint
34+
run: bundle exec rubocop

.gitignore

+60
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
*.gem
2+
*.rbc
3+
/.config
4+
/coverage/
5+
/InstalledFiles
6+
/pkg/
7+
/spec/reports/
8+
/spec/examples.txt
9+
/test/tmp/
10+
/test/version_tmp/
11+
/tmp/
12+
13+
# Used by dotenv library to load environment variables.
14+
# .env
15+
16+
# Ignore Byebug command history file.
17+
.byebug_history
18+
19+
## Specific to RubyMotion:
20+
.dat*
21+
.repl_history
22+
build/
23+
*.bridgesupport
24+
build-iPhoneOS/
25+
build-iPhoneSimulator/
26+
27+
## Specific to RubyMotion (use of CocoaPods):
28+
#
29+
# We recommend against adding the Pods directory to your .gitignore. However
30+
# you should judge for yourself, the pros and cons are mentioned at:
31+
# https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
32+
#
33+
# vendor/Pods/
34+
35+
## Documentation cache and generated files:
36+
/.yardoc/
37+
/_yardoc/
38+
/doc/
39+
/rdoc/
40+
41+
## Environment normalization:
42+
/.bundle/
43+
/vendor/bundle
44+
/lib/bundler/man/
45+
46+
# for a library or gem, you might want to ignore these files since the code is
47+
# intended to run in multiple environments; otherwise, check them in:
48+
# Gemfile.lock
49+
# .ruby-version
50+
# .ruby-gemset
51+
52+
# unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
53+
.rvmrc
54+
55+
# Used by RuboCop. Remote config files pulled in from inherit_from directive.
56+
# .rubocop-https?--*
57+
58+
# PoC and tests
59+
poc.rb
60+
test.rb

.rubocop.yml

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
AllCops:
2+
TargetRubyVersion: 2.6
3+
NewCops: enable
4+
Exclude:
5+
- 'test/*.rb'
6+
SuggestExtensions: false
7+
Layout/HashAlignment:
8+
Exclude:
9+
- '*.gemspec'
10+
Metrics/AbcSize:
11+
Enabled: false
12+
Style/OptionalBooleanParameter:
13+
Enabled: false

.tool-versions

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
ruby 3.0.1
2+
nodejs 14.15.1

.yardopts

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
--output-dir docs/yard
2+
-
3+
--main README.md
4+
LICENSE

Gemfile

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# frozen_string_literal: true
2+
3+
source 'https://rubygems.org'
4+
5+
# Specify your gem's dependencies in .gemspec
6+
gemspec

Gemfile.lock

+57
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
PATH
2+
remote: .
3+
specs:
4+
tls-map (1.0.0)
5+
docopt (~> 0.6)
6+
paint (~> 2.2)
7+
8+
GEM
9+
remote: https://rubygems.org/
10+
specs:
11+
ast (2.4.2)
12+
commonmarker (0.21.2)
13+
ruby-enum (~> 0.5)
14+
concurrent-ruby (1.1.8)
15+
docopt (0.6.1)
16+
github-markup (4.0.0)
17+
i18n (1.8.10)
18+
concurrent-ruby (~> 1.0)
19+
paint (2.2.1)
20+
parallel (1.20.1)
21+
parser (3.0.1.0)
22+
ast (~> 2.4.1)
23+
rainbow (3.0.0)
24+
redcarpet (3.5.1)
25+
regexp_parser (2.1.1)
26+
rexml (3.2.5)
27+
rubocop (1.13.0)
28+
parallel (~> 1.10)
29+
parser (>= 3.0.0.0)
30+
rainbow (>= 2.2.2, < 4.0)
31+
regexp_parser (>= 1.8, < 3.0)
32+
rexml
33+
rubocop-ast (>= 1.2.0, < 2.0)
34+
ruby-progressbar (~> 1.7)
35+
unicode-display_width (>= 1.4.0, < 3.0)
36+
rubocop-ast (1.4.1)
37+
parser (>= 2.7.1.5)
38+
ruby-enum (0.9.0)
39+
i18n
40+
ruby-progressbar (1.11.0)
41+
unicode-display_width (2.0.0)
42+
yard (0.9.26)
43+
44+
PLATFORMS
45+
x86_64-linux
46+
47+
DEPENDENCIES
48+
bundler (>= 2.1.0, < 2.3)
49+
commonmarker (~> 0.21)
50+
github-markup (~> 4.0)
51+
redcarpet (~> 3.5)
52+
rubocop (~> 1.10)
53+
tls-map!
54+
yard (~> 0.9)
55+
56+
BUNDLED WITH
57+
2.2.15

LICENSE

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2021 Alexandre ZANNI at SEC-IT
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

+44
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# TLS map
2+
3+
[![Gem Version](https://badge.fury.io/rb/tls-map.svg)](https://badge.fury.io/rb/tls-map)
4+
![GitHub tag (latest SemVer)](https://img.shields.io/github/tag/sec-it/tls-map)
5+
[![GitHub forks](https://img.shields.io/github/forks/sec-it/tls-map)](https://github.com/sec-it/tls-map/network)
6+
[![GitHub stars](https://img.shields.io/github/stars/sec-it/tls-map)](https://github.com/sec-it/tls-map/stargazers)
7+
[![GitHub license](https://img.shields.io/github/license/sec-it/tls-map)](https://github.com/sec-it/tls-map/blob/master/LICENSE.txt)
8+
[![Rawsec's CyberSecurity Inventory](https://inventory.rawsec.ml/img/badges/Rawsec-inventoried-FF5050_flat.svg)](https://inventory.rawsec.ml/tools.html#TLS%20map)
9+
10+
[![Packaging status](https://repology.org/badge/vertical-allrepos/tls-map.svg)](https://repology.org/project/tls-map/versions)
11+
12+
![logo](docs/_media/logo.png)
13+
14+
> CLI & library for mapping TLS cipher algorithm names: IANA, OpenSSL, GnUTLS, NSS
15+
16+
**CLI**
17+
18+
[![asciicast](https://asciinema.org/a/410877.svg)](https://asciinema.org/a/410877)
19+
20+
**Library**
21+
22+
![library example](https://i.imgur.com/3KZgZ6b.png)
23+
24+
## Features
25+
26+
- CLI and library
27+
- Search feature: hexadecimal codepoint and major TLS libraries cipher algorithm name: IANA, OpenSSL, GnuTLS, NSS
28+
- Export to files: markdown table, expanded JSON, minified JSON, Ruby marshalized hash
29+
30+
## Installation
31+
32+
```plaintext
33+
$ gem install tls-map
34+
```
35+
36+
Check the [installation](https://sec-it.github.io/tls-map/) page on the documentation to discover more methods.
37+
38+
## Documentation
39+
40+
Homepage / Documentation: https://sec-it.github.io/tls-map/
41+
42+
## Author
43+
44+
Made by Alexandre ZANNI ([@noraj](https://pwn.by/noraj/)), pentester at [SEC-IT](https://sec-it.fr).

bin/tls-map

+64
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
#!/usr/bin/env ruby
2+
# frozen_string_literal: true
3+
4+
# Ruby internal
5+
require 'pp'
6+
# Project internal
7+
require 'tls_map'
8+
require 'tls_map/cli'
9+
# External
10+
require 'docopt'
11+
require 'paint'
12+
13+
doc = <<~DOCOPT
14+
TLS map
15+
16+
Usage:
17+
tls-map search <critera> <term> [-o <output> --force] [--no-color --debug]
18+
tls-map export <filename> <format> [--force] [--debug]
19+
tls-map update [--debug]
20+
tls-map -h | --help
21+
tls-map --version
22+
23+
Search options: (offline)
24+
<critera> The type of term. Accepted values: codepoint, iana, openssl, gnutls, nss.
25+
<term> The cipher algorithm name.
26+
-o, --output <output> Displayed fields. Accepted values: all, codepoint, iana, openssl, gnutls, nss. [default: all]
27+
28+
Export options: (offline)
29+
<filename> The output file name to write to.
30+
<format> Supported formats: markdown (a markdown table), json_pretty (expanded JSON), json_compact (minified JSON), marshal (Ruby marshalized hash).
31+
32+
Update options: (online) DANGEROUS, will break database integrity, force option will be required
33+
34+
Other options:
35+
--force Force parsing even if intigrity check failed (DANGEROUS, may result in command execution vulnerability)
36+
--no-color Disable colorized output
37+
--debug Display arguments
38+
-h, --help Show this screen
39+
--version Show version
40+
DOCOPT
41+
42+
begin
43+
args = Docopt.docopt(doc, version: TLSmap::VERSION)
44+
Paint.mode = 0 if args['--no-color']
45+
pp args if args['--debug']
46+
if args['search']
47+
cli = TLSmap::CLI.new(args['--force'])
48+
res = cli.search(args['<critera>'].to_sym, args['<term>'], args['--output'].to_sym)
49+
puts Paint['No match found', :red] if res.empty?
50+
res.each do |k, v|
51+
puts "#{Paint[k, :green]}: #{Paint[v, :white]}"
52+
end
53+
elsif args['export']
54+
cli = TLSmap::CLI.new(args['--force'])
55+
cli.export(args['<filename>'], args['<format>'].to_sym)
56+
puts "#{args['<filename>']} exported"
57+
elsif args['update']
58+
cli = TLSmap::CLI.new
59+
cli.update
60+
puts 'Database updated'
61+
end
62+
rescue Docopt::Exit => e
63+
puts e.message
64+
end

bin/tls-map_console

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/usr/bin/env ruby
2+
# frozen_string_literal: true
3+
4+
require 'tls_map'
5+
require 'irb'
6+
7+
IRB.start(__FILE__)

0 commit comments

Comments
 (0)