text stringlengths 14 100k | source stringclasses 1
value | repo stringclasses 810
values | language stringclasses 13
values |
|---|---|---|---|
<|fim_prefix|>#!/usr/bin/env python3
import os
import sys
import subprocess as sp
from plyer import notification
_ = r"""
show os notification on upload; works on windows, linux, macos, android
dependencies:
windows: python3 -m pip install --user -U plyer
linux: python3 -m pip install --user -U plyer
... | fim | 9001/copyparty | python |
<|fim_suffix|>"linux" else ""
msg += f"\nπ€ {inf['user']} ({inf['ip']})\nπ {mt}"
if "com.termux" in sys.executable:
sp.run(["termux-notification", "-t", title, "-c", msg])
return
notification.notify(
title=title,
message=msg,
app_icon=icon,
timeout=10,
... | fim | 9001/copyparty | python |
<|fim_suffix|>to the folder where the file was uploaded
# and create the subfolder to place the normalized copy inside
dirpath, filename = os.path.split(abspath)
os.chdir(fsenc(dirpath))
os.makedirs(SUBDIR, exist_ok=True)
# the input and output filenames to give ffmpeg
fname_in = fsenc(f"./{fil... | fim | 9001/copyparty | python |
<|fim_prefix|>#!/usr/bin/env python3
# coding: utf-8
import os
import sys
import json
import shutil
import subprocess as sp
_ = r"""
start downloading a torrent by POSTing a magnet URL to copyparty,
for example using π (message-to-server-log) in the web-ui
by default it will download the torrent to the folder you ... | fim | 9001/copyparty | python |
<|fim_prefix|>#!/usr/bin/env python3
import json
import os
import re
import sys
_ = r"""
reject file upload (with a nice explanation why)
example usage as global config:
--xbu j,c1,bin/hooks/reject-and-explain.py
example usage as a volflag (per-volume config):
-v srv/inc:inc:r:rw,ed:c,xbu=j,c1,bin/hooks/re... | fim | 9001/copyparty | python |
<|fim_suffix|> running this plugin on all uploads with the params listed below)
parameters explained,
xbu = execute before upload
c = check result, reject upload if error
"""
def main():
bad = "exe scr com pif bat ps1 jar msi"
ext = sys.argv[1].split(".")[-1]
sys.exit(1 if ext in bad.split() ... | fim | 9001/copyparty | python |
<|fim_prefix|>#!/usr/bin/env python3
import sys
import magic
_ = r"""
reject file uploads by mimetype
dependencies (linux, macos):
python3 -m pip install --user -U python-magic
dependencies (windows):
python3 -m pip install --user -U <|fim_suffix|>def main():
ok = ["image/jpeg", "image/png"]
mt = ... | fim | 9001/copyparty | python |
<|fim_prefix|>#!/usr/bin/env python3
import os
import threading
from argparse import Namespace
from jinja2.nodes import Name
from copyparty.fsutil import Fstab
from typing import Any, Optional
_ = r"""
reject an upload if the target folder is on a ramdisk; useful when you
have a volume where some folders inside are... | fim | 9001/copyparty | python |
<|fim_suffix|>that in the upload path:
m = re.search(r"\b(op|ed)([^a-z]|$)", fn)
if m:
# the regex matched; use "anime-op" or "anime-ed"
effect = {"vp": "/anime-" + m[1]}
# aaand DO IT
print(json.dumps({"reloc": effect}))
if __name__ == "__main__":
main()
<|fim_prefix|>#!/usr/bin/... | fim | 9001/copyparty | python |
#!/usr/bin/env python3
import os
import sys
_ = r"""
rename incoming uploads according to the "wark" (the file identifier)
which is basically but not exactly a sha512 hash of the file contents
NOTE: this does NOT work with up2k uploads (dragdrop into browser);
combine this hook with reloc-by-wark-xbu.py to fix th... | fim | 9001/copyparty | python |
<|fim_prefix|>#!/usr/bin/env python3
import os
_ = r"""
rename incoming uploads according to the "wark" (the file identifier)
which is basically but not exactly a sha512 hash of <|fim_suffix|>reject upload if this hook crashes due to a bug
example usage as a volflag (per-volume config):
-v srv/inc:inc:r:rw,ed:c... | fim | 9001/copyparty | python |
<|fim_prefix|>// see usb-eject.py for usage
function usbclick() {
var o = QS('#treeul a[dst="/usb/"]') || QS('#treepar a[dst="/usb/"]');
if (o)
o.click();
}
function eject_cb() {
var t = ('' + this.responseText).trim();
if (t.indexOf('can be safely unplugged') < 0 && t.indexOf('Device can be r... | fim | 9001/copyparty | javascript |
<|fim_prefix|>#!/usr/bin/env python3
import os
import stat
import subprocess as sp
import sys
from urllib.parse import unquote_to_bytes as unquote
"""
if you've found yourself using copyparty to serve flashdrives on a LAN
and your only wish is that <|fim_suffix|>ive
cmd = b"sudo -u egon DBUS_SESSION_BUS_ADDR... | fim | 9001/copyparty | python |
<|fim_suffix|>d = ["wget", "--trust-server-names", "-nv", "--", url]
try:
# two things to note here:
# - cannot use the `c3` hook-flag with `I` so mute output with stdout=sp.DEVNULL instead;
# - MUST NOT use os.chdir with 'I' so use cwd=dirpath instead
sp.check_call(cmd, cwd=dirpat... | fim | 9001/copyparty | python |
#!/usr/bin/env python3
import os
import sys
import json
import subprocess as sp
_ = r"""
use copyparty as a file downloader by POSTing URLs as
application/x-www-form-urlencoded (for example using the
π message-to-server-log in the web-ui)
example usage as global config:
--xm aw,f,j,t3600,bin/hooks/wget.py
par... | fim | 9001/copyparty | python |
<|fim_prefix|>#!/usr/bin/env python3
import hashlib
import json
import sys
from datetime import datetime, timezone
_ = r"""
this hook will produce a single sha512 file <|fim_suffix|>ning this plugin on batches of uploads with the params listed below)
parameters explained,
xiu = execute after uploads...
i5 ... | fim | 9001/copyparty | python |
<|fim_prefix|>#!/usr/bin/env python3
import json
import sys
_ = r"""
this hook prints absolute filepaths + total size
use this with --xiu, which makes copyparty buffer
uploads until server is idle, providing file infos
on stdin (filepaths or json)
example usage as global config:
--xiu i1,j,bin/hooks/xiu.py
ex... | fim | 9001/copyparty | python |
<|fim_prefix|>#!/usr/bin/env python
import os
import sys
import vamp
import tempfile
import numpy as np
<|fim_suffix|>oot-vamp:beatroot")
cl = c["list"]
except:
# fallback; 73% accuracy
plug = "vamp-example-plugins:fixedtempo"
c = vamp.collect(d, 22050, plug, par... | fim | 9001/copyparty | python |
<|fim_suffix|>stdin",
"-hide_banner",
"-v", "fatal",
"-y"
]
for seg in segs:
cmd.extend([
"-ss", str(seg[0]),
"-i", fsenc(sys.argv[1])
])
filt = ""
for n, seg in enumerate(segs):
filt += "[{}:a:0]atrim=duration={}[a{}]; ".form... | fim | 9001/copyparty | python |
<|fim_prefix|>#!/usr/bin/env python
import os
import sys
import tempfile
import subprocess as sp
try:
<|fim_suffix|>elete=False) as f:
f.write(b"h")
tf = f.name
try:
det(tf)
except:
pass # mute
finally:
os.unlink(tf)
if __name__ == "__main__":
main()
<|fim... | fim | 9001/copyparty | python |
<|fim_prefix|>#!/usr/bin/env python3
import sys
import json
import struct
import base64
import hashlib
try:
from zlib_ng import zlib_ng as zlib
except:
import zlib
try:
from copyparty.util import fsenc
except:
def fsenc(p):
return p
"""
calculates various checksums for uploads,
usage: -mtp... | fim | 9001/copyparty | python |
<|fim_prefix|>#!/usr/bin/env python
import sys
import time
import json
import pefile
"""
retrieve exe info,
example for multivalue providers
"""
def unk(v):
return "unk({:04x})".format(v)
class PE2(pefile.PE):
def __init__(self, *a, **ka):
for k in [
# -- parse_data_directories:
... | fim | 9001/copyparty | python |
<|fim_prefix|>#!/usr/bin/env python
import sys
"""
example that just prints the file extension
"""
print(sys.argv[1].split("."<|fim_suffix|>[-1])
<|fim_middle|>)<|endoftext|> | fim | 9001/copyparty | python |
<|fim_suffix|>ty, subregion, region"
usage: -mtp .masl,.gps_lat,.gps_lon,city=ad,t10,bin/mtag/geotag.py
example: https://a.ocv.me/pub/blog/j7/8/?grid=0
"""
def main():
cmd = b"exiftool -api geolocation -n".split(b" ")
rc, so, se = runcmd(cmd + [fsenc(sys.argv[1])])
ptn = re.compile("([^:]*[^ :]) *: (.*)... | fim | 9001/copyparty | python |
#!/usr/bin/env python3
"""
fetch latest msg from guestbook and return as tag
example copyparty config to use this:
--urlform save,get -vsrv/hello:hello:w:c,e2ts,mtp=guestbook=t10,ad,p,bin/mtag/guestbook-read.py:mte=+guestbook
explained:
for realpath srv/hello (served at /hello), write-only for everyone,
enable... | fim | 9001/copyparty | python |
<|fim_suffix|>e(t, (ip, ts, txt))
if NUM_MSGS_TO_KEEP > 1:
t = "select ts from gb where ip = ? order by ts desc"
hits = db.execute(t, (ip,)).fetchall()
if len(hits) > NUM_MSGS_TO_KEEP:
lim = hits[NUM_MSGS_TO_KEEP][0]
t = "delete from gb where... | fim | 9001/copyparty | python |
<|fim_prefix|>#!/usr/bin/env python3
"""
remove exif tags from uploaded images
d<|fim_suffix|>opyparty.util import fsenc
except:
def fsenc(p):
return p.encode("utf-8")
def main():
cwd, fn = os.path.split(sys.argv[1])
if os.path.basename(cwd) == "noexif":
return
os.chdir(cwd)
f1... | fim | 9001/copyparty | python |
<|fim_suffix|> "__main__":
main()
<|fim_prefix|>#!/usr/bin/env python
import re
import sys
import json
import time
import base64
import hashlib
import subprocess as sp
try:
from copyparty.util import fsenc
except:
def fsenc(p):
return p.encode("utf-8")
"""
dep: ffmpeg
"""
def det():
# fmt... | fim | 9001/copyparty | python |
<|fim_suffix|> ad: dontcare if audio or not
p: priority 1 (run after initial tag-scan with ffprobe or mutagen)
"""
def main():
env = os.environ.copy()
env["DISPLAY"] = ":0.0"
if False:
# open the uploaded file
fp = sys.argv[-1]
else:
# display stdin contents (`oth_tag... | fim | 9001/copyparty | python |
<|fim_prefix|>#!/usr/bin/env python
import json
import os
import subprocess as sp
import sys
import time
try:
from copyparty.util import fsenc
except:
def fsenc(p):
return p.encode("utf-8")
_ = r"""
first checks the tag "vidchk" which must be "ok" to continue,
then uploads all files to some cloud s... | fim | 9001/copyparty | python |
<|fim_suffix|>ideo').muted = false;
}, 200);
}
var scr = document.createElement('script');
scr.textContent = '(' + grunnur.toString() + ')();';
(document.head || document.getElementsByTagName('head')[0]).appendChild(scr);
<|fim_prefix|>// ==UserScript==
// @name twitter-unmute
// @namespace http://ocv.m... | fim | 9001/copyparty | javascript |
<|fim_prefix|>// ==UserScript==
// @name <|fim_suffix|> }
setInterval(collect, interval * 1000);
}
var scr = document.createElement('script');
scr.textContent = '(' + main.toString() + ')();';
(document.head || document.getElementsByTagName('head')[0]).appendChild(scr);
console.log('[yt-pdh] a');
<|fim_middle|... | fim | 9001/copyparty | javascript |
<|fim_prefix|>#!/usr/bin/env python
import time
import random
v = r<|fim_suffix|>) * 6
time.sleep(v)
print(f"{v:.2f}")
<|fim_middle|>andom.random(<|endoftext|> | fim | 9001/copyparty | python |
<|fim_suffix|>-------------------------------------------------------------
#!/bin/bash
set -e
# create qr code
ip=$(ip r | awk '/^default/{print$(NF-2)}'); echo http://$ip:3923/ | qrencode -o - -s 4 >/dev/shm/cpp-qr.png
/usr/bin/feh -x /dev/shm/cpp-qr.png &
# reposition and make topmost (with janky raspbian support... | fim | 9001/copyparty | python |
<|fim_prefix|>#!/usr/bin/env python3
import json
import re
import os
import sys
import subprocess as sp
try:
from copyparty.util import fsenc
except:
def fsenc(p):
return p.encode("utf-8")
_ = r"""
inspects video files for errors and such
plus stores a bunch of metadata to filename.ff.json
usage:
... | fim | 9001/copyparty | python |
<|fim_prefix|>#!/usr/bin/env python3
"""
DEPRECATED -- replaced by event hooks;
https://github.com/9001/copyparty/blob/hovudstraum/bin/hooks/wget.py
---
use copyparty as a file downloader by POSTing URLs as
application/x-www-form<|fim_suffix|>for example using the
message/pager function on the website)
example copy... | fim | 9001/copyparty | python |
<|fim_suffix|> in priority.items():
for itag in itags:
url = None
for afmt in pd["streamingData"]["adaptiveFormats"]:
if itag == afmt["itag"]:
url = afmt["url"]
break
if url:
ret[stream] = {itag: url}
... | fim | 9001/copyparty | python |
<|fim_suffix|>, help="file cache"
)
ap.add_argument("-a", metavar="PASSWORD", help="password")
ap.add_argument("-d", action="store_true", help="enable debug")
ap.add_argument("-te", metavar="PEM_FILE", help="certificate to expect/verify")
ap.add_argument("-td", action="store_true", help="disable cer... | fim | 9001/copyparty | python |
<|fim_suffix|> for cn in self.filecache:
ncn += 1
cache_path, cache1 = cn.tag
if cache_path != path:
continue
cache2 = cache1 + len(cn.data)
if get2 <= cache1 or get1 >= cache2:
# request does not... | fim | 9001/copyparty | python |
<|fim_suffix|> h_end = file_sz
buf_ofs = (get2 - get1) - len(car)
dbg(
"<cache> car {}, cdr {}-{}={} [:{}]".format(
len(car), h_ofs, h_end, h_end - h_ofs, buf_ofs
)
)
buf = self.gw.download_file_range(path, ... | fim | 9001/copyparty | python |
<|fim_prefix|>#!/usr/bin/env python3
"""
partyjournal.py: chronological history of uploads
2021-12-31, v0.1, ed <irc.rizon.net>, MIT-Licensed
https://github.com/9001/copyparty/blob/hovudstraum/bin/partyjournal.py
produces a chronological list of all uploads,
by collecting info from up2k databases and the filesystem
... | fim | 9001/copyparty | python |
<|fim_suffix|>ake will fix it
with self.mutex:
sz = fsl.len
file.ucids = [x for x in file.ucids if x not in cids]
if not file.ucids:
file.t1_up = time.time()
self.q_handshake.put(file)
self.st_up = [fil... | fim | 9001/copyparty | python |
<|fim_prefix|>#!/usr/bin/env python3
"""
unforget.py: rebuild db from logfiles
2022-09-07, v0.1, ed <irc.rizon.net>, MIT-Licensed
https://github.com/9001/copyparty/blob/hovudstraum/bin/unforget.py
only makes sense if running copyparty with --no-forget
(e.g. immediately shifting uploads to other storage)
usage:
xz ... | fim | 9001/copyparty | python |
<|fim_prefix|>#!/usr/bin/env python3
import sys
import zmq
"""
zmq-recv.py: demo zmq receiver
2025-01-22, v1.0, ed <irc.rizon.net>, MIT-Licensed
https://github.com/9001/copyparty/blob/hovudstraum/bin/zmq-recv.py
basic zmq-server to receive events from copyparty; try one of
the below and then "send a message to serve... | fim | 9001/copyparty | python |
<|fim_prefix|>#!/usr/bin/env python3
# Update the Nix package pin
#
# Usage: ./update.sh [PATH]
# When the [PATH] is not set, it will fetch the latest release from the repo.
# With [PATH] set, it will hash the given file and generate the URL,
# base on the version contained within the file
import base64
import json
i... | fim | 9001/copyparty | python |
<|fim_suffix|>ser_download_url"]
asset = requests.get(download_url)
formatted_hash = get_formatted_hash(asset.content)
result = {"url": download_url, "version": version, "hash": formatted_hash}
return result
def main():
result = remote_release_pin()
print(result)
json_result = json.dumps... | fim | 9001/copyparty | python |
<|fim_prefix|>(function() {
// usage: copy this to '.banner.js' in your webroot,
// and run copyparty with the following arguments:
// --js-browser /.banner.js --js-other /.banner.js
// had to pick the most chuuni one as the default
var bannertext = '' +
'<h3>You are accessing a U.S. Government (USG) Information S... | fim | 9001/copyparty | javascript |
<|fim_prefix|>// USAGE:
// place this file somewhere in the webroot and then
// python3 -m copyparty --js-browser /.res/graft-thumbs.js
//
// DESCRIPTION:
// this is a gridview plugin which, for each file in a folder,
// looks for another file with the same filename (but with a
// different file extension)
//... | fim | 9001/copyparty | javascript |
<|fim_suffix|>modifier-on {
background-color: lightblue;
}
.keybaord-key.keybaord-backspace {
width: 82px;
}
.keybaord-key.keybaord-tab {
width: 55px;
}
.keybaord-key.keybaord-enter {
width: 69px;
}
.keybaord-key.keybaord-capslock {
width: 80px;
}
.keybaord-key.keybaord-backslash {
width: 88px;
}
.keybaord-... | fim | 9001/copyparty | javascript |
<|fim_suffix|>ar e2 = mknod('div');
e2.innerHTML = u2min;
ebi('wrap').insertBefore(e2, QS('#wfp'));
}
<|fim_prefix|>/*
makes the up2k ui REALLY minimal by hiding a bunch of stuff
almost the same as minimal-up2k.html except this one...:
-- appl<|fim_middle|>ies to every write-only folder when used with --js-brow... | fim | 9001/copyparty | javascript |
<|fim_suffix|>od(e))
return main_hotkey_handler(e); // let copyparty handle this keystroke
var keycode = (e.key || e.code) + '',
ae = document.activeElement,
aet = ae && ae != document.body ? ae.nodeName.toLowerCase() : '';
// check the current aet (active element type),
... | fim | 9001/copyparty | javascript |
<|fim_suffix|>, beats_url);
var xhr = new XHR();
xhr.open('GET', beats_url, true);
xhr.onload = readbeats;
xhr.url = beats_url;
xhr.send();
}
function rave_unload() {
qsr('#fft');
can = null;
}
function readbeats() {
if (this.url != beats... | fim | 9001/copyparty | javascript |
<|fim_prefix|>// way more specific example --
// assumes all files dropped into the uploader have a youtube-id somewhere in the filename,
// locates the youtube-ids and passes them to an API which returns a list of IDs which should be uploaded
//
// also tries to find the youtube-id in the embedded metadata
//
// assum... | fim | 9001/copyparty | javascript |
<|fim_suffix|>d will show an alert in the final hook
// bad_files are unreadable and cannot be uploaded
var file_lists = [good_files, nil_files, bad_files];
// build a list of filenames
var filenames = [];
for (var lst of file_lists)
for (var ent of lst)
filenames.push(ent[1]);
... | fim | 9001/copyparty | javascript |
<|fim_prefix|>#!/usr/bin/env python3
import os
import sqlite3
import sys
import traceback
"""
when the up2k-database is stored on a zfs volume, this may give
slightly higher performance (actual gains not measured yet)
NOTE: must be applied in combination with the related advice in the openzfs documentation;
https:/... | fim | 9001/copyparty | python |
<|fim_suffix|>0, 0, 14393])
)
# introduced in anniversary update
ANYWIN = WINDOWS or sys.platform in ["msys", "cygwin"]
MACOS = platform.system() == "Darwin"
FREEBSD = platform.system() == "FreeBSD"
OPENBSD = platform.system() == "OpenBSD"
ANYBSD = FREEBSD or OPENBSD
UNIX = MACOS or ANYBSD
GRAAL = platform.pytho... | fim | 9001/copyparty | python |
<|fim_prefix|># coding: utf-8
VERSION = (1, 20, 16)
CODENAME = "sftp is fine too"
BUILD_DT = (2026, 5, 26)
S_VERSION = ".".join(map(str, VERSION))
S_BUILD_DT = "{0:04d}-{1:02d}-{2:02d}".format(*BUILD_DT)
__version__ = S_VERSION
__build_dt__ = S_BU<|fim_suffix|><|fim_middle|>ILD_DT
# I'm all ears
<|endoftext|> | fim | 9001/copyparty | python |
<|fim_prefix|># coding: utf-8
from __future__ import print_function, unicode_literals
import os
import time
from ..util import SYMTIME, fsdec, fsenc
from . import path as path
if True: # pylint: disable=using-constant-test
from typing import Any, Optional, Union
from ..util import NamedLogger
MKD_755 = {"... | fim | 9001/copyparty | python |
<|fim_prefix|># coding: utf-8
from __future__ import print_function, unicode_literals
import os
from ..util import SYMTIME, fsdec, fsenc
def abspath(p: str) -> str:
return fsdec(os.path.abspath(fsenc(p)))
def exists(p: str) -> bool:
return os.path.exists(fsenc(p))
def getmtime(p: str, follow_symlinks: b... | fim | 9001/copyparty | python |
<|fim_prefix|># coding: utf-8
from __future__ import print_function, unicode_literals
import threading
import time
import traceback
import queue
from .__init__ import CORES, TYPE_CHECKING
from .broker_mpw import MpWorker
from .broker_util import ExceptionalQueue, NotExQueue, try_exec
from .util import Daemon, mp
if... | fim | 9001/copyparty | python |
<|fim_prefix|># coding: utf-8
from __future__ import print_function, unicode_literals
import argparse
import os
import signal
import sys
import threading
import queue
from .__init__ import ANYWIN
from .authsrv import AuthSrv
from .broker_util import BrokerCli, ExceptionalQueue, NotExQueue
from .fsutil import ramdisk... | fim | 9001/copyparty | python |
<|fim_prefix|># coding: utf-8
from __future__ import print_function, unicode_literals
import os
import threading
from .__init__ import TYPE_CHECKING
from .broker_util import BrokerCli, ExceptionalQueue, NotExQueue
from .httpsrv import HttpSrv
from .util import HMaccas
if TYPE_CHECKING:
from .svchub import SvcHub... | fim | 9001/copyparty | python |
<|fim_suffix|>ant_retval:
raise
return ["exception", "pebkac", ex.code, str(ex)]
except Exception as ex:
if not want_retval:
raise
return ["exception", "stack", ex]
<|fim_prefix|># coding: utf-8
from __future__ import print_function, unicode_literals
import argpar... | fim | 9001/copyparty | python |
<|fim_prefix|>import calendar
import errno
import json
import os
import shutil
import time
from .__init__ import ANYWIN
from .util import Netdev, atomic_move, load_resource, runcmd, wunlink
HAVE_CFSSL = not os.environ.get("PRTY_NO_CFSSL")
if True: # pylint: disable=using-constant-test
from .util import NamedLog... | fim | 9001/copyparty | python |
<|fim_suffix|>oes not require a valid dirkey to do so',
"rmagic": "expensive analysis for mimetype accuracy",
"shr_who=auth": "who can create shares? no/auth/a",
"unp_who=2": "unpost only if same... 1=ip+name, 2=ip, 3=name",
"ups_who=2": "restrict viewing the list of recent uploads",
... | fim | 9001/copyparty | python |
<|fim_prefix|># coding: utf-8
from __future__ import print_function, unicode_literals
import importlib
import sys
import xml.etree.ElementTree as ET
from .__init__ import PY2
if True: # pylint: disable=using-constant-test
from typing import Any, Optional
class BadXML(Exception):
pass
def get_ET() -> ET.... | fim | 9001/copyparty | python |
<|fim_prefix|># coding: utf-8
from __future__ import print_function, unicode_literals
import argparse
import json
import os
import re
import time
from .__init__ import ANYWIN, FREEBSD, MACOS, UNIX
from .authsrv import AXS, VFS, AuthSrv
from .bos import bos
from .util import chkcmd, json_hesc, min_ex, undot
if True: ... | fim | 9001/copyparty | python |
<|fim_suffix|>.pop(ap, None)
# print("xfer_end: {} => {}".format(ap, vp))
if vp:
vp, fn = os.path.split(vp)
vfs, rem = self.hub.asrv.vfs.get(vp, self.uname, False, True)
vfs, rem = vfs.get_dbv(rem)
self.hub.up2k.hash_file(
vfs.realpath,
... | fim | 9001/copyparty | python |
<|fim_suffix|>lf.s, "shared_ciphers"):
ciphers = self.s.shared_ciphers()
assert ciphers # !rm
overlap = [str(y[::-1]) for y in ciphers]
self.log("TLS cipher overlap:" + "\n".join(overlap))
for k, v in [
... | fim | 9001/copyparty | python |
<|fim_suffix|>break
if not n:
log("waiting for up2k to finish initializing", 6)
time.sleep(1 if n < 10 else 5 if n < 300 else 15)
if not self.thumbcli:
log("no thumbcli", 1)
return
if self.args.th_pre_rl:
try:
... | fim | 9001/copyparty | python |
<|fim_prefix|># coding: utf-8
from __future__ import print_function, unicode_literals
import argparse # typechk
import colorsys
import hashlib
import re
from .__init__ import PY2
from .th_srv import HAVE_PIL, HAVE_PILF
from .util import BytesIO, html_escape # type: ignore
class Ico(object):
def __init__(self,... | fim | 9001/copyparty | python |
<|fim_prefix|># coding: utf-8
from __future__ import print_function, unicode_literals
import errno
import os
import random
import select
import socket
import time
from ipaddress import IPv4Network, IPv6Network
from .__init__ import TYPE_CHECKING
from .__init__ import unicode as U
from .multicast import MC_Sck, MCast... | fim | 9001/copyparty | python |
<|fim_suffix|>s % (k, k, unit, k, desc, k, v))
def addh(k: str, typ: str, desc: str) -> None:
zs = "# TYPE %s %s\n# HELP %s %s"
ret.append(zs % (k, typ, k, desc))
def addbh(k: str, desc: str) -> None:
zs = "# TYPE %s gauge\n# UNIT %s bytes\n# HELP %s %s"
... | fim | 9001/copyparty | python |
<|fim_suffix|> sv = str(zv).split("/")[0].strip().lstrip("0")
ret[sk] = sv or 0
# normalize key notation to rekobo
okey = ret.get("key")
if okey:
key = str(okey).replace(" ", "").replace("maj", "").replace("min", "m")
ret["key"] = REKOBO_LKEY.... | fim | 9001/copyparty | python |
<|fim_prefix|># coding: utf-8
from __future__ import print_function, unicode_literals
import socket
import time
import ipaddress
from ipaddress import (
IPv4Address,
IPv4Network,
IPv6Address,
IPv6Network,
ip_address,
ip_network,
)
from .__init__ import MACOS, TYPE_CHECKING
from .util import I... | fim | 9001/copyparty | python |
<|fim_prefix|># coding: utf-8
from __future__ import print_function, unicode_literals
import argparse
import base64
import hashlib
import os
import sys
import threading
from .__init__ import unicode
try:
if os.environ.get("PRTY_NO_ARGON2"):
raise Exception()
HAVE_ARGON2 = True
from argon2 import... | fim | 9001/copyparty | python |
<|fim_suffix|>age
tab = qr.modules
sz = qr.size
psz = sz + pad * 2
if bg:
img = Image.new("RGB", (psz, psz), bg)
else:
img = Image.new("RGBA", (psz, psz), (0, 0, 0, 0))
fg = (fg[0], fg[1], fg[2], 255)
for y in range(sz):
for x in range(sz):
if tab[y][... | fim | 9001/copyparty | python |
<|fim_suffix|> self.log(" `- file didn't exist; returning ENOENT")
return SFTP_NO_SUCH_FILE
except:
pass
return SFTP_PERMISSION_DENIED
except OSError as ex:
self.log("failed: rm(%s): %r" % (vp, ex))
return param... | fim | 9001/copyparty | python |
# coding: utf-8
import inspect
import logging
import os
import random
import stat
import sys
import time
from types import SimpleNamespace
from .__init__ import ANYWIN, EXE, TYPE_CHECKING
from .authsrv import LEELOO_DALLAS, VFS
from .bos import bos
from .util import Daemon, absreal, min_ex, pybin, runhook, vjoin
if ... | fim | 9001/copyparty | python |
<|fim_suffix|>socket] = rdy[0] # type: ignore
self.rxc.cln()
buf = b""
addr = ("0", 0)
for sck in rx:
try:
buf, addr = sck.recvfrom(4096)
self.eat(buf, addr)
except:
if not self.... | fim | 9001/copyparty | python |
<|fim_prefix|># coding: utf-8
from __future__ import print_function, unicode_literals
import re
import stat
import tarfile
from queue import Queue
from .authsrv import AuthSrv
from .bos import bos
from .sutil import StreamArc, errdesc
from .util import Daemon, fsenc, min_ex
if True: # pylint: disable=using-constan... | fim | 9001/copyparty | python |
<|fim_suffix|>nslib/tree/0.9.23
"""
from .dns import *
version = "0.9.23"
<|fim_prefix|># coding: utf-8
<|fim_middle|>
"""
L: MIT
Copyright (c) 2010 - 2017 Paul Chakravarti
https://github.com/paulc/d<|endoftext|> | fim | 9001/copyparty | python |
<|fim_suffix|>
raise AttributeError()
return self.reverse[k]
except KeyError:
if isinstance(self.error, types.FunctionType):
return self.error(self.name, k, False)
else:
raise self.error("%s: Invalid reverse lookup: [%s]" % (sel... | fim | 9001/copyparty | python |
<|fim_prefix|># coding: utf-8
from __future__ import print_function
def get_bits(data, offset, bits=1):
mask = ((1 << bits) - 1) << offset
r<|fim_suffix|>s(data, value, offset, bits=1):
mask = ((1 << bits) - 1) << offset
clear = 0xFFFF ^ mask
data = (data & clear) | ((value << offset) & mask)
... | fim | 9001/copyparty | python |
<|fim_suffix|>rn struct.unpack(fmt, data)
except struct.error:
raise BufferError(
"Error unpacking struct '%s' <%s>"
% (fmt, binascii.hexlify(data).decode())
)
def __len__(self):
return len(self.data)
<|fim_prefix|># coding: utf-8
import bina... | fim | 9001/copyparty | python |
<|fim_suffix|>t_label(self):
return self._label
label = property(get_label, set_label)
def pack(self, buffer):
buffer.encode_name(self.label)
buffer.append(encode_type_bitmap(self.rrlist))
def __repr__(self):
return "%s %s" % (self.label, " ".join(self.rrlist))
attrs ... | fim | 9001/copyparty | python |
<|fim_prefix|># coding: utf-8
from __future__ import print_function
import re
from .bit import get_bits, set_bits
from .buffer import Buffer, BufferError
LDH = set(range(33, 127))
ESCAPE = re.compile(r"\\([0-9][0-9][0-9])")
avahi_379 = 0
def set_avahi_379():
global avahi_379
avahi_379 = 1
def log_avah... | fim | 9001/copyparty | python |
<|fim_prefix|># coding: utf-8
from __future__ import print_function
import collections
try:
f<|fim_suffix|>f):
return (None, None)
<|fim_middle|>rom StringIO import StringIO
except ImportError:
from io import StringIO
class Lexer(object):
escape_chars = "\\"
escape = {"n": "\n", "t": "\t",... | fim | 9001/copyparty | python |
<|fim_suffix|>)
byte_types = (str, bytearray)
else:
int_types = (int,)
byte_types = (bytes, bytearray)
def check_instance(name, val, types):
if not isinstance(val, types):
raise ValueError(
"Attribute '%s' must be instance of %s [%s]" % (name, types, type(val))
)
def chec... | fim | 9001/copyparty | python |
<|fim_suffix|> get_adapters
else:
print("ifaddr unavailable; can't determine LAN IP: unsupported OS")
get_adapters = nope
__all__ = ["Adapter", "IP", "get_adapters"]
<|fim_prefix|># coding: utf-8
from __future__ import print_function, unicode_literals
"""
L: BSD-2-Clause
Copyright (c) 2014 Stefan C. Mueller
... | fim | 9001/copyparty | python |
<|fim_prefix|># coding: utf-8
from __future__ import print_function, unicode_literals
import collections
import ctypes.util
import os
import socket
import ipaddress
if True: # pylint: disable=using-constant-test
from typing import Iterable, Optional
from . import _shared as shared
from ._shared import U
clas... | fim | 9001/copyparty | python |
<|fim_prefix|># coding: utf-8
from __future__ import print_function, unicode_literals
import ctypes
import platform
import socket
import sys
import ipaddress
if True: # pylint: disable=using-constant-test
from typing import Callable, List, Optional, Union
PY2 = sys.version_info < (3,)
if not PY2:
U: Calla... | fim | 9001/copyparty | python |
<|fim_prefix|># coding: utf-8
from __future__ import print_function, unicode_literals
import ctypes
from ctypes import wintypes
if True: # pylint: disable=using-constant-test
from typing import Iterable, List
from . import _shared as shared
NO_ERROR = 0
ERROR_BUFFER_OVERFLOW = 111
MAX_ADAPTER_NAME_LENGTH = 256... | fim | 9001/copyparty | python |
<|fim_suffix|>y][x] = isdark
self.unmaskable[y][x] = True
def _add_ecc_and_interleave(self, data: bytearray) -> bytes:
ver: int = self.ver
assert len(data) == QrCode._get_num_data_codewords(ver, self.ecclvl)
# Calculate parameter numbers
numblocks: int = QrCode._NUM_ERROR_C... | fim | 9001/copyparty | python |
<|fim_prefix|># coding: utf-8
"""
This is Victor Stinner's pure-Python implementation of PEP 383: the "surrogateescape" error
handler of Python 3.
Scissored from the python-future module to avoid 4.4MB of additional dependencies:
https://github.com/PythonCharmers/python-future/blob/e12549c42ed3a38ece45b9d88c75f5f3ee4... | fim | 9001/copyparty | python |
<|fim_prefix|># coding: utf-8
from __future__ import print_function, unicode_literals
import os
import tempfile
from datetime import datetime
from .__init__ import CORES, TYPE_CHECKING
from .authsrv import LEELOO_DALLAS, VFS, AuthSrv
from .bos import bos
from .th_cli import ThumbCli
from .th_srv import TH_CH
from .ut... | fim | 9001/copyparty | python |
<|fim_suffix|>
raise
if self.logf:
self.logf.write(msg)
if not self.args.no_logflush:
self.logf.flush()
def _log_en_f2(self, src: str, msg: str, c: Union[int, str] = 0) -> None:
with self.log_mutex:
dt = dateti... | fim | 9001/copyparty | python |
<|fim_prefix|># coding: utf-8
from __future__ import print_function, unicode_literals
import calendar
import stat
import time
from .authsrv import AuthSrv
from .bos import bos
from .sutil import StreamArc, errdesc
from .util import VPTL_WIN, min_ex, sanitize_to, spack, sunpack, yieldfile, zlib
if True: # pylint: di... | fim | 9001/copyparty | python |
<|fim_suffix|> e = "\033[1;31munix-socket {} is busy\033[0m".format(ip)
elif ex.errno in E_ADDR_NOT_AVAIL:
e = "\033[1;31minterface {} does not exist\033[0m".format(ip)
if not e:
if not tcp:
t = "\n\n\n NOTE: this crash may be due to a uni... | fim | 9001/copyparty | python |
<|fim_suffix|>a, **ka)
if wr and "fperms" in vfs.flags:
set_fperms(ret, vfs.flags)
return ret
def _mkdir(self, vpath: str, *a) -> None:
vfs, _, ap = self._v2a("mkdir", vpath, [False, True])
if "*" not in vfs.axs.uwrite:
yeet("blocked mkdir; folder not world-... | fim | 9001/copyparty | python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.