summaryrefslogtreecommitdiff
path: root/html/payload_create.html
blob: 0a5577e82e722969bf92ac9af9283b15b00a4a29 (about) (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
#IF !PAYLOAD_CREATE_LOADED
#DEFINE PAYLOAD_CREATE_LOADED
<!--
    SPDX-License-Identifier: GPL-3.0-or-later OR CC-BY-SA-4.0

    Simple site payload creation form.

    This file is part of Haketilo.

    Copyright (C) 2022 Wojtek Kosior <koszko@koszko.org>

    File is dual-licensed. You can choose either GPLv3+, CC BY-SA or both.

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <https://www.gnu.org/licenses/>.

    I, Wojtek Kosior, thereby promise not to sue for violation of this file's
    licenses. Although I request that you do not make use of this code in a
    proprietary program, I am not going to enforce this in court.
  -->

<!--
    This is not a standalone page. This file is meant to be imported into other
    HTML code.
  -->

#INCLUDE html/dialog.html

#LOADCSS html/reset.css
#LOADCSS html/base.css
#LOADCSS html/grid.css
<style>
  .payload_create_main_view {
      overflow-y:auto;
      height: var(--content-height);
  }
  .payload_create_form {
      margin: 0 0.6em;
      padding-top: 1em;
  }
  .payload_create_form>* {
      margin: 0.3em 0;
  }
  .payload_create_form>textarea {
      resize: vertical;
      height: 5em;
  }
  .payload_create_form>textarea.payload_create_script {
      height: 18em;
      font-family: monospace;
  }
  .payload_create_buts {
      text-align: center;
      margin: 0.5em 0;
  }
</style>
<template>
  <div id="payload_create" data-template="main_div"
       class="payload_create_main_view">
    <div data-template="form_container">
      <div class="grid_1 payload_create_form">
	<span>
	  <label>identifier*</label>
	  (may only contain digits 0-9, lowercase letters a-z and hyphens '-';
	  will have 'local-' prepended):
	</span>
	<input data-template="identifier">
	<span>
	  <label>long name</label> (defaults to the same as identifier):
	</span>
	<input data-template="long_name">
	<span><label>description</label>:</span>
	<textarea data-template="description"></textarea>
	<span>
	  <label><a data-template="patterns_link">URL patterns</a>*</label>
	  (put each on its own line):
	</span>
	<textarea data-template="patterns">https://example.com/***</textarea>
	<span><label>script to inject*</label>:</span>
	<textarea data-template="script" class="payload_create_script"
		  >console.log("Hello, World!");</textarea>
	<div class="payload_create_buts">
	  <button data-template="create_but">Create</button>
	</div>
      </div>
    </div>
    <div data-template="dialog_container" class="hide">
      <!-- dialog div will be dynamically inserted here -->
    </div>
  </div>
</template>
#ENDIF
.cm { color: #888888 } /* Comment.Multiline */ .highlight .cp { color: #cc0000; font-weight: bold } /* Comment.Preproc */ .highlight .cpf { color: #888888 } /* Comment.PreprocFile */ .highlight .c1 { color: #888888 } /* Comment.Single */ .highlight .cs { color: #cc0000; font-weight: bold; background-color: #fff0f0 } /* Comment.Special */ .highlight .gd { color: #000000; background-color: #ffdddd } /* Generic.Deleted */ .highlight .ge { font-style: italic } /* Generic.Emph */ .highlight .gr { color: #aa0000 } /* Generic.Error */ .highlight .gh { color: #333333 } /* Generic.Heading */ .highlight .gi { color: #000000; background-color: #ddffdd } /* Generic.Inserted */ .highlight .go { color: #888888 } /* Generic.Output */ .highlight .gp { color: #555555 } /* Generic.Prompt */ .highlight .gs { font-weight: bold } /* Generic.Strong */ .highlight .gu { color: #666666 } /* Generic.Subheading */ .highlight .gt { color: #aa0000 } /* Generic.Traceback */ .highlight .kc { color: #008800; font-weight: bold } /* Keyword.Constant */ .highlight .kd { color: #008800; font-weight: bold } /* Keyword.Declaration */ .highlight .kn { color: #008800; font-weight: bold } /* Keyword.Namespace */ .highlight .kp { color: #008800 } /* Keyword.Pseudo */ .highlight .kr { color: #008800; font-weight: bold } /* Keyword.Reserved */ .highlight .kt { color: #888888; font-weight: bold } /* Keyword.Type */ .highlight .m { color: #0000DD; font-weight: bold } /* Literal.Number */ .highlight .s { color: #dd2200; background-color: #fff0f0 } /* Literal.String */ .highlight .na { color: #336699 } /* Name.Attribute */ .highlight .nb { color: #003388 } /* Name.Builtin */ .highlight .nc { color: #bb0066; font-weight: bold } /* Name.Class */ .highlight .no { color: #003366; font-weight: bold } /* Name.Constant */ .highlight .nd { color: #555555 } /* Name.Decorator */ .highlight .ne { color: #bb0066; font-weight: bold } /* Name.Exception */ .highlight .nf { color: #0066bb; font-weight: bold } /* Name.Function */ .highlight .nl { color: #336699; font-style: italic } /* Name.Label */ .highlight .nn { color: #bb0066; font-weight: bold } /* Name.Namespace */ .highlight .py { color: #336699; font-weight: bold } /* Name.Property */ .highlight .nt { color: #bb0066; font-weight: bold } /* Name.Tag */ .highlight .nv { color: #336699 } /* Name.Variable */ .highlight .ow { color: #008800 } /* Operator.Word */ .highlight .w { color: #bbbbbb } /* Text.Whitespace */ .highlight .mb { color: #0000DD; font-weight: bold } /* Literal.Number.Bin */ .highlight .mf { color: #0000DD; font-weight: bold } /* Literal.Number.Float */ .highlight .mh { color: #0000DD; font-weight: bold } /* Literal.Number.Hex */ .highlight .mi { color: #0000DD; font-weight: bold } /* Literal.Number.Integer */ .highlight .mo { color: #0000DD; font-weight: bold } /* Literal.Number.Oct */ .highlight .sa { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Affix */ .highlight .sb { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Backtick */ .highlight .sc { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Char */ .highlight .dl { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Delimiter */ .highlight .sd { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Doc */ .highlight .s2 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Double */ .highlight .se { color: #0044dd; background-color: #fff0f0 } /* Literal.String.Escape */ .highlight .sh { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Heredoc */ .highlight .si { color: #3333bb; background-color: #fff0f0 } /* Literal.String.Interpol */ .highlight .sx { color: #22bb22; background-color: #f0fff0 } /* Literal.String.Other */ .highlight .sr { color: #008800; background-color: #fff0ff } /* Literal.String.Regex */ .highlight .s1 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */ .highlight .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */ .highlight .bp { color: #003388 } /* Name.Builtin.Pseudo */ .highlight .fm { color: #0066bb; font-weight: bold } /* Name.Function.Magic */ .highlight .vc { color: #336699 } /* Name.Variable.Class */ .highlight .vg { color: #dd7700 } /* Name.Variable.Global */ .highlight .vi { color: #3333bb } /* Name.Variable.Instance */ .highlight .vm { color: #336699 } /* Name.Variable.Magic */ .highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */

0TDNS - Zero Trust DNS

A way to control name resolution

NOTE: This program was written for a univerity course. It probably has no uses for you. It just serves as part of my CV.

First - get some openvpn config; http://vpngate.net seems like a good place to go

ACHTUNG! Openvpn configs can be malicious and can execute arbitrary commands on your system! Always look into the config before using it :)

Now let's say you want to run ping fsf.org through openvpn connection. Let's say conf.ovpn is your openvpn config file. First, install relevant scripts on your system

# ./install.sh

You can also install to an arbitrary directory (0tdns won't run from there, however; this is just to make things easier for distro packagers or to install in a chroot)

# ./install.sh /path/to/installation/root

The install.sh script above only copies some files to the filesystem. You also need some setup, which is done with

# ./setup.sh

For now, the setup.sh script creates a 0tdns user in the system and adds an entry in root's crontab. Some other setup-related stuff might be added to it later.

One might wonder why there isn't a single script to install files and setup the system? The reason is, again, to make things easier for distros. Packager would install software to a directory and make a package from it (using appropriate tools, of course). They would use commands from setup.sh to create a script, that is attached to the package and run at installation.

Now, execute:

# ./vpn_wrapper.sh conf.ovpn ping fsf.org

the wrapper shall create an openvpn connection and a network namespace with all packets (except those to localhost) routed through the vpn. It then executes given command inside the namespace.

For now - this is all that can be simply tried out. Other parts of the project work with database.

For other half (database creation and front-end) check https://github.com/kamsza/io_django

You can remove te user nad crontab entry with

# ./uninstall.sh

To do this and also remove files, run

# ./uninstall.sh --delete-files