Skip to content

Commit

Permalink
Merge pull request #98 from IanLee1521/dockerfile
Browse files Browse the repository at this point in the history
Dockerfile
  • Loading branch information
IanLee1521 committed Nov 20, 2018
2 parents 94af805 + 87397fb commit 5d88399
Show file tree
Hide file tree
Showing 7 changed files with 73 additions and 33 deletions.
14 changes: 14 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
FROM python:3

WORKDIR /app

COPY requirements.txt requirements.txt

RUN pip install --no-cache-dir -r requirements.txt

COPY . .

RUN pip install --editable .

ENTRYPOINT ["trustymail"]
CMD ["--help"]
40 changes: 24 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,14 @@ Then run the CLI:
python scripts/trustymail [options] example.com
```

### Using Docker (optional)

```bash
./run [opts]
```

`opts` are the same arguments that would get passed to `trustymail`.

### Usage and examples ###

```bash
Expand All @@ -61,38 +69,38 @@ output will always be written to disk, defaulting to `results.csv`.
-h --help Show this message.
-o --output=OUTFILE Name of output file. (Default results)
-t --timeout=TIMEOUT The DNS lookup timeout in seconds. (Default is 5.)
--smtp-timeout=TIMEOUT The SMTP connection timeout in seconds. (Default
--smtp-timeout=TIMEOUT The SMTP connection timeout in seconds. (Default
is 5.)
--smtp-localhost=HOSTNAME The hostname to use when connecting to SMTP
--smtp-localhost=HOSTNAME The hostname to use when connecting to SMTP
servers. (Default is the FQDN of the host from
which trustymail is being run.)
--smtp-ports=PORTS A comma-delimited list of ports at which to look
--smtp-ports=PORTS A comma-delimited list of ports at which to look
for SMTP servers. (Default is '25,465,587'.)
--no-smtp-cache Do not cache SMTP results during the run. This
may results in slower scans due to testing the
--no-smtp-cache Do not cache SMTP results during the run. This
may results in slower scans due to testing the
same mail servers multiple times.
--mx Only check mx records
--starttls Only check mx records and STARTTLS support.
--starttls Only check mx records and STARTTLS support.
(Implies --mx.)
--spf Only check spf records
--dmarc Only check dmarc records
--debug Output should include error messages.
--dns=HOSTNAMES A comma-delimited list of DNS servers to query
against. For example, if you want to use
Google's DNS then you would use the
value --dns-hostnames='8.8.8.8,8.8.4.4'. By
default the DNS configuration of the host OS
(/etc/resolv.conf) is used. Note that
the host's DNS configuration is not used at all
--dns=HOSTNAMES A comma-delimited list of DNS servers to query
against. For example, if you want to use
Google's DNS then you would use the
value --dns-hostnames='8.8.8.8,8.8.4.4'. By
default the DNS configuration of the host OS
(/etc/resolv.conf) is used. Note that
the host's DNS configuration is not used at all
if this option is used.
--psl-filename=FILENAME The name of the file where the public suffix list
(PSL) cache will be saved. If set to the name of
an existing file then that file will be used as
the PSL. If not present then the PSL cache will
be saved to a file in the current directory called
public_suffix_list.dat.
--psl-read-only If present, then the public suffix list (PSL)
cache will be read but never overwritten. This
--psl-read-only If present, then the public suffix list (PSL)
cache will be read but never overwritten. This
is useful when running in AWS Lambda, for
instance, where the local filesystem is read-only.
```
Expand Down Expand Up @@ -160,7 +168,7 @@ The following values are returned in `results.csv`:
* `DMARC Aggregate Report URIs` - A list of the DMARC aggregate report
URIs specified by the domain.
* `DMARC Forensic Report URIs` - A list of the DMARC forensic report
URIs specified by the domain.
URIs specified by the domain.
* `DMARC Has Aggregate Report URI` - A boolean value that indicates if
`DMARC Results` included `rua` URIs that tell recipients where to
send DMARC aggregate reports.
Expand Down
7 changes: 7 additions & 0 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
-r requirements.txt

check-manifest>=0.36
pytest>=3.5.0
semver>=2.7.9
tox>=3.0.0
wheel>=0.31.0
7 changes: 6 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1,6 @@
-e .[dev]
dnspython>=1.15.0
docopt>=0.6.2
publicsuffix>=1.1.0
py3dns>=3.1.0
pyspf==2.0.11
requests>=2.18.4
11 changes: 11 additions & 0 deletions run
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/bash

set -e
set -x

docker build -t trustymail/cli .

docker run --rm -it \
--name trustymail \
-v $(pwd):/app \
trustymail/cli $@
25 changes: 10 additions & 15 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,14 @@ def readme():
return f.read()


with open('requirements.txt') as fp:
reqs = [line.strip() for line in fp.readlines() if line]

with open('requirements-dev.txt') as fp:
lines = [line.strip() for line in fp.readlines() if line]
dev_reqs = [line for line in lines if line and '-r requirements.txt' not in line]


setup(
name='trustymail',
version=__version__,
Expand Down Expand Up @@ -61,23 +69,10 @@ def readme():

packages=['trustymail'],

install_requires=[
'dnspython>=1.15.0',
'docopt>=0.6.2',
'publicsuffix>=1.1.0',
'py3dns>=3.1.0',
'pyspf==2.0.11',
'requests>=2.18.4'
],
install_requires=reqs,

extras_require={
'dev': [
'check-manifest>=0.36',
'pytest>=3.5.0',
'semver>=2.7.9',
'tox>=3.0.0',
'wheel>=0.31.0'
],
'dev': dev_reqs,
},

scripts=['scripts/trustymail']
Expand Down
2 changes: 1 addition & 1 deletion trustymail/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from __future__ import unicode_literals, absolute_import, print_function

__version__ = '0.6.4'
__version__ = '0.6.5-dev'

PublicSuffixListFilename = 'public_suffix_list.dat'
PublicSuffixListReadOnly = False

0 comments on commit 5d88399

Please sign in to comment.