mirror of https://github.com/9001/r0c.git
misc cleanup:
* change start-r0c.* to invoke argparse * improve help-texts, messages * make-sfx works on windows
This commit is contained in:
parent
871117ea6e
commit
7255e0ec1b
|
@ -76,7 +76,7 @@ if you enable TLS with `-tpt 2424` (telnet) and/or `-tpn 1515` (netcat) you can
|
|||
* `socat -,raw,echo=0 openssl:r0c.int:1515,cafile=cert.crt`
|
||||
* `stty -icanon; ncat --ssl --ssl-trustfile r0c.crt -v r0c.int 1515`
|
||||
* `stty -icanon; openssl s_client -CAfile ~/.r0c/cert.crt -nbio -connect r0c.int:1515`
|
||||
* windows: powershell client with port `+1515` (the `+` enables TLS)
|
||||
* windows: [powershell client](https://github.com/9001/r0c/blob/master/clients/powershell.ps1) with port `+1515` (the `+` enables TLS)
|
||||
* powershell does not verify certificate; the other clients do
|
||||
|
||||
|
||||
|
|
|
@ -43,8 +43,8 @@ def optgen(ap, pwd):
|
|||
ac.add_argument("-i", metavar="IP", type=u, default="0.0.0.0", help="address to listen on")
|
||||
ac.add_argument("-pt", metavar="PORT", type=int, default=pt, help="telnet port (disable with 0)")
|
||||
ac.add_argument("-pn", metavar="PORT", type=int, default=pn, help="netcat port (disable with 0)")
|
||||
ac.add_argument("-tpt", metavar="PORT", type=int, default=0, help="TLS telnet port (disable with 0)")
|
||||
ac.add_argument("-tpn", metavar="PORT", type=int, default=0, help="TLS netcat port (disable with 0)")
|
||||
ac.add_argument("-tpt", metavar="PORT", type=int, default=0, help="TLS telnet port, e.g. 2424 (disable with 0)")
|
||||
ac.add_argument("-tpn", metavar="PORT", type=int, default=0, help="TLS netcat port, e.g. 1515 (disable with 0)")
|
||||
ac.add_argument("-pw", metavar="PWD", type=u, default=pwd, help="admin password")
|
||||
ac.add_argument("--nsalt", metavar="TXT", type=u, default="lammo/", help="salt for generated nicknames based on IP")
|
||||
|
||||
|
@ -90,7 +90,7 @@ def run_fap(argv, pwd):
|
|||
ap = Fargparse()
|
||||
optgen(ap, pwd)
|
||||
|
||||
if "-h" in unicode(argv + [""])[1]:
|
||||
if "-h" in unicode(([""] + argv)[-1]):
|
||||
print()
|
||||
print("arg 1: Telnet port (0=disable), default: {0}".format(ap.pt))
|
||||
print("arg 2: NetCat port (0=disable), default: {0}".format(ap.pn))
|
||||
|
@ -227,9 +227,9 @@ printf '%s\\n' GK . . . . r0c.int . | openssl req -newkey rsa:2048 -sha256 -keyo
|
|||
|
||||
if ar.pw == "hunter2":
|
||||
print("\033[1;31m")
|
||||
print(" using the default password;")
|
||||
print(" change it with argument -pw")
|
||||
print(" or save it here: " + pwd_file)
|
||||
print(" using default password '{0}'".format(ar.pw))
|
||||
print(" change it with argument -pw or save it here:")
|
||||
print(" " + pwd_file)
|
||||
print("\033[0m")
|
||||
|
||||
print(" * Logs at " + EP.log)
|
||||
|
|
|
@ -5,8 +5,7 @@ echo
|
|||
|
||||
# optional args:
|
||||
#
|
||||
# `clean` uses files from git (everything except web/deps),
|
||||
# so local changes won't affect the produced sfx
|
||||
# `clean` uses files from git so local changes won't affect the produced sfx
|
||||
|
||||
|
||||
# differences from copyparty sfx:
|
||||
|
@ -20,8 +19,7 @@ echo
|
|||
name=r0c
|
||||
|
||||
[ -e $name/__main__.py ] || cd ..
|
||||
[ -e $name/__main__.py ] ||
|
||||
{
|
||||
[ -e $name/__main__.py ] || {
|
||||
printf "run me from within the project root folder\n\n"
|
||||
exit 1
|
||||
}
|
||||
|
@ -47,6 +45,11 @@ gtar=$(command -v gtar || command -v gnutar) || true
|
|||
bzip2() { /opt/local/bin/bzip2 "$@"; }
|
||||
}
|
||||
|
||||
pybin=$(command -v python3 || command -v python) || {
|
||||
echo need python
|
||||
exit 1
|
||||
}
|
||||
|
||||
while [ ! -z "$1" ]; do
|
||||
[ "$1" = clean ] && clean=1 && shift && continue
|
||||
break
|
||||
|
@ -145,7 +148,7 @@ unc="$HOME/dev/copyparty/scripts/uncomment.py"
|
|||
find | grep -E '\.py$' |
|
||||
grep -vE '__version__' |
|
||||
tr '\n' '\0' |
|
||||
xargs -0 python3 $unc 1
|
||||
xargs -0 $pybin $unc 1
|
||||
|
||||
echo
|
||||
echo creating tar
|
||||
|
@ -173,7 +176,7 @@ mv -v $minf tar.bz2
|
|||
rm t.*
|
||||
|
||||
echo creating sfx
|
||||
python3 ../scripts/sfx.py --sfx-make tar.bz2 $ver $ts
|
||||
$pybin ../scripts/sfx.py --sfx-make tar.bz2 $ver $ts
|
||||
mv sfx.out $sfx_out.py
|
||||
chmod 755 $sfx_out.*
|
||||
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
python -m r0c.__main__ 23 531 %1 || pause
|
||||
python -m r0c.__main__ %* || pause
|
||||
|
||||
@REM if an argument is provided to this bat file,
|
||||
@REM it will be used as the admin password.
|
||||
@REM
|
||||
@REM "r0c.__main__" is required by python 2.6;
|
||||
@REM all other python versions are happy with:
|
||||
@REM python -m r0c 23 531
|
||||
@REM additional arguments can be given to this batch file, for example
|
||||
@REM -pw goodpassword
|
||||
@REM -tpt 2424 (enable tls telnet on port 2424)
|
||||
@REM -tpn 1515 (enable tls netcat on port 1515)
|
||||
@REM --old-tls (allow old/buggy software to connect (centos6, powershell))
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
try {
|
||||
Invoke-Expression "python -m r0c.__main__ 23 531 $args"
|
||||
Invoke-Expression "python -m r0c.__main__ $args"
|
||||
}
|
||||
catch {
|
||||
Write-Host -NoNewLine "press ENTER to terminate "
|
||||
|
@ -13,9 +13,8 @@ if ($LASTEXITCODE -ne 0) {
|
|||
exit 1
|
||||
}
|
||||
|
||||
# if an argument is provided to this ps1 file,
|
||||
# it will be used as the admin password.
|
||||
#
|
||||
# "r0c.__main__" is required by python 2.6;
|
||||
# all other python versions are happy with:
|
||||
# python -m r0c 23 531
|
||||
# additional arguments can be given to this batch file, for example
|
||||
# -pw goodpassword
|
||||
# -tpt 2424 (enable tls telnet on port 2424)
|
||||
# -tpn 1515 (enable tls netcat on port 1515)
|
||||
# --old-tls (allow old/buggy software to connect (centos6, powershell))
|
||||
|
|
26
start-r0c.sh
26
start-r0c.sh
|
@ -1,23 +1,9 @@
|
|||
#!/bin/bash
|
||||
|
||||
preferred_ports="23 531"
|
||||
fallback_ports="2323 1531"
|
||||
python3 -m r0c.__main__ "$@"
|
||||
|
||||
# use preferred ports if root,
|
||||
# otherwise use fallback ports
|
||||
[ $(id -u) -eq 0 ] &&
|
||||
ports="$preferred_ports" ||
|
||||
ports="$fallback_ports"
|
||||
|
||||
# if no arguments:
|
||||
# start r0c with password from config file
|
||||
[ "x$1" == "x" ] &&
|
||||
python3 -m r0c.__main__ $ports
|
||||
|
||||
# otherwise,
|
||||
# start r0c with the provided password
|
||||
[ "x$1" == "x" ] ||
|
||||
python3 -m r0c.__main__ $ports "$1"
|
||||
|
||||
# usually just "r0c" is enough,
|
||||
# but python 2.6 needs the full "r0c.__main__"
|
||||
# additional arguments can be given to this batch file, for example
|
||||
# -pw goodpassword
|
||||
# -tpt 2424 (enable tls telnet on port 2424)
|
||||
# -tpn 1515 (enable tls netcat on port 1515)
|
||||
# --old-tls (allow old/buggy software to connect (centos6, powershell))
|
||||
|
|
Loading…
Reference in New Issue