├── .gitignore ├── BUGS ├── CHANGELOG ├── COOKIES ├── FAQ ├── INSTALL ├── INSTALL.cuftpd ├── LICENSE ├── Makefile.in ├── README ├── README.AMD64 ├── README.ZSCONFIG ├── README.datacleaner ├── README.mp3-genres ├── README.sitewho ├── TODO ├── UPDATING ├── aclocal.m4 ├── config.guess ├── config.h.in ├── config.sub ├── configGen ├── config.yaml └── configGen.rb ├── configure ├── configure.in ├── install-sh ├── lib ├── Makefile.in └── strl │ ├── Makefile.in │ ├── strl.h │ └── strlcpy.c ├── ng-install.sh ├── scripts ├── audio-genre │ ├── README │ └── audio-genre-create.sh ├── cleaner │ ├── README │ └── cleaner.sh ├── debug_checker │ ├── debug_checker.sh │ ├── wrapper.README │ └── wrapper.sh ├── libcopy │ └── libcopy.sh ├── logtrimmer │ ├── README │ └── logtrimmer.sh ├── nfoextract │ ├── complete_script_wrapper.sh │ └── nfoextract.sh ├── obsolete │ ├── getnfo2.0.tar.gz │ └── psxc-rescan_v0.2.tgz ├── precheck │ └── pre_check.tcl ├── psxc-imdb │ ├── CHANGELOG │ ├── FAQ │ ├── FILES │ ├── README │ ├── README.installer │ ├── README.psxc-imdb-dotimdb │ ├── README.psxc-imdb-find │ ├── README.use.of.special.format │ ├── TODO │ ├── UPGRADING │ ├── addons │ │ ├── psxc-imdb-dotimdb.pl │ │ ├── psxc-imdb-nuker.sh │ │ └── psxc-symlink-maker.sh │ ├── extras │ │ ├── psxc-imdb-find.sh │ │ ├── psxc-imdb-parser.sh │ │ ├── psxc-imdb-rescan.sh │ │ └── psxc-imdb-sanity.sh │ ├── installer.sh │ ├── main │ │ ├── old │ │ │ ├── psxc-imdb-bot.tcl │ │ │ └── psxc-imdb-conf.tcl │ │ ├── psxc-imdb.conf │ │ ├── psxc-imdb.sh │ │ ├── psxc-imdb.tcl │ │ └── psxc-imdb.zpt │ └── other │ │ ├── libcopy.sh │ │ ├── makeclean.sh │ │ ├── makediff.sh │ │ ├── psxc-depcheck_v0.1.tgz │ │ └── stripcr.sh └── psxc-trailer │ ├── CHANGELOG │ └── psxc-trailer.sh ├── sitebot ├── COOKIES ├── README ├── UPDATING ├── cookies-file-generator.tcl ├── extra │ ├── fakelog.sh │ ├── incomplete-list.sh │ ├── invite.sh │ └── ng-topic.sh ├── modules │ ├── cuftpd.tcl │ ├── example.tcl │ └── glftpd.tcl ├── ngBot.conf.defaults ├── ngBot.conf.dist ├── ngBot.help ├── ngBot.tcl ├── ngBot.vars ├── obsolete │ ├── bnccheck.tcl │ ├── cookie-parsing.tcl │ ├── incomplete-list-old.sh │ ├── ngbot.tcl │ ├── ngbot_conf.tcl │ ├── ngplugins │ │ └── ng_parsefile.tcl │ └── weektop.sh ├── plugins │ ├── AutoIRCFlag.tcl │ ├── Blow.tcl │ ├── Blow.zpt │ ├── DeluserBan.tcl │ ├── Example.tcl │ ├── Example.zpt │ ├── GameFAQs.tcl │ ├── GameFAQs.zpt │ ├── NickDb.tcl │ ├── PreTime.tcl │ ├── PreTime.zpt │ ├── README │ ├── TVMaze.tcl │ ├── TVMaze.zpt │ ├── TVRage.tcl │ ├── TVRage.zpt │ ├── Top.tcl │ └── fishwrap.py ├── src │ ├── Makefile.in │ ├── dl_speedtest.c │ ├── passchk.c │ └── showlog.c └── themes │ ├── broken │ └── icefury.zst │ ├── classic.zst │ ├── d3x0c.zst │ ├── dakrer.zst │ ├── default.zst │ ├── liquid.zst │ ├── nfs.zst │ ├── psxc.zst │ ├── vampire.zst │ └── wshadow.zst ├── sitewho ├── CHANGELOG ├── Makefile.in ├── obsolete │ └── bandwidth.sh ├── sitewho.c ├── sitewho.conf.in ├── sitewho.h ├── structonline.h ├── who.foot └── who.head ├── version.sh └── zipscript ├── conf ├── zsconfig.h.all.sh ├── zsconfig.h.complete ├── zsconfig.h.dist ├── zsconfig.h.dist-nonglftpd └── zsconfig.h.ss5.dist ├── include ├── abs2rel.h ├── audio.h ├── audiosort.h ├── avi.h ├── cleanup.h ├── complete.h ├── constants.dzsbot.h ├── constants.h ├── constants.json.h ├── constants.ss5.h ├── convert.h ├── crc.h ├── datacleaner.h ├── dizreader.h ├── errors.h ├── helpfunctions.h ├── macros.h ├── mp3info.h ├── multimedia.h ├── ng-chown.h ├── objects.h ├── postdel.h ├── postunnuke.h ├── print_config.h ├── race-file.h ├── scandir.h ├── stats.h ├── strsep.h ├── video.h ├── zsconfig.defaults.h └── zsfunctions.h ├── src ├── Makefile.in ├── abs2rel.c ├── audiosort-bin.c ├── audiosort.c ├── banned_filelist.txt ├── cleanup.c ├── complete.c ├── convert.c ├── crc.c ├── datacleaner.c ├── dizreader.c ├── helpfunctions.c ├── mp3info.c ├── multimedia.c ├── ng-chown.c ├── ng-deldir.c ├── ng-undupe.c ├── postdel.c ├── postunnuke.c ├── print_config.c ├── race-file.c ├── racestats.c ├── rescan.c ├── scandir.c ├── stats.c ├── strsep.c ├── zipscript-c.c └── zsfunctions.c └── utils ├── Makefile.in ├── headdatatest.c ├── racedatatest.c └── sfvdatatest.c /.gitignore: -------------------------------------------------------------------------------- 1 | # Build & configure 2 | Makefile 3 | /config.h 4 | /config.log 5 | /config.status 6 | 7 | # Configuration 8 | /sitewho/sitewho.conf 9 | /zipscript/conf/zsconfig.h 10 | 11 | # Produced object files 12 | *.o 13 | *.dSYM/ 14 | 15 | # Generated version 16 | /zipscript/include/ng-version.h 17 | 18 | # Produced binaries 19 | /sitebot/src/dl_speedtest 20 | /sitebot/src/passchk 21 | /sitebot/src/showlog 22 | /sitewho/sitewho 23 | /zipscript/src/audiosort 24 | /zipscript/src/cleanup 25 | /zipscript/src/datacleaner 26 | /zipscript/src/ng-chown 27 | /zipscript/src/ng-deldir 28 | /zipscript/src/ng-undupe 29 | /zipscript/src/postdel 30 | /zipscript/src/postunnuke 31 | /zipscript/src/racestats 32 | /zipscript/src/rescan 33 | /zipscript/src/zipscript-c 34 | 35 | # Produced binaries with "make utils" 36 | /zipscript/utils/headdatatest 37 | /zipscript/utils/racedatatest 38 | /zipscript/utils/sfvdatatest 39 | -------------------------------------------------------------------------------- /BUGS: -------------------------------------------------------------------------------- 1 | TODO is now deprecated. use http://bugs.pzs-ng.com/. 2 | (You can report bugs and classify them as features to add feature-requests) 3 | Thank you. :-) 4 | -------------------------------------------------------------------------------- /COOKIES: -------------------------------------------------------------------------------- 1 | ############# Cookies: 2 | # 3 | #### Race Totals 4 | # 5 | %r = release name 6 | %? = current path 7 | %~ = current path 8 | %^ = base path 9 | 10 | %u = # of users in race 11 | %g = # of groups in race 12 | %f = # of files in release 13 | %F = # of uploaded files 14 | %o = # of rejected files 15 | %M = # of missing files 16 | 17 | %e = estimated release size in mb 18 | %b = total bytes uploaded 19 | %k = total kilobytes uploaded 20 | %P = total kilobytes in rejected files 21 | %m = total megabytes uploaded 22 | %O = total megabytes in rejected files 23 | %n = name of current file 24 | %p = percent of files uploaded (uploaded files / totalfiles * 100) 25 | %N = total mbits uploaded 26 | 27 | %a = average speed per transfer (kb/sec) 28 | %A = average speed (kb/sec) 29 | %d = race length (so far) 30 | %$ = estimated time left of race 31 | %& = epoch (so far) 32 | # 33 | #### Current User 34 | # 35 | %U = Name 36 | %S = Speed (kb/sec) 37 | %# = Speed (MB/s) 38 | %s = Speed (Mbps) 39 | %G = Primary group 40 | # 41 | #### Appended messages 42 | # 43 | %R = Racers message 44 | %B = All Racers 45 | %l = Fastest file message 46 | %L = Slowest file message 47 | %t = Group TopN 48 | %T = User TopN 49 | %Cn = Racestats of n:th racer (n = 0-9, 0 = 1st, 1 = 2nd, 2 = 3rd...) 50 | %cn = Racestats of n:th group 51 | # 52 | #### Static cookies 53 | # 54 | %Z = short_sitename 55 | %% = % char 56 | %K = user's tagline 57 | # 58 | #### Special cookies 59 | # 60 | %v = Error message 61 | %V = Progress bar (14 Chars) 62 | # 63 | #### Audio MP3/FLAC specific cookies 64 | # 65 | %x = Artist 66 | %w = Genre 67 | %W = Album 68 | %y = Title 69 | %Y = Year 70 | %z = Sampling rate 71 | %X = Bitrate 72 | %h = Codec 73 | %q = Layer (MP3 Only) 74 | %Q = Channel mode 75 | %i = VBR version string 76 | %I = VBR preset (MP3 Only) 77 | %j = vbr/cbr info 78 | %@ = vbr-old/vbr-new (MP3 Only) 79 | %_ = vbr quality (1-100, 100 = lowest) (MP3 Only) 80 | %/ = vbr minimum bitrate (on APS this is average bitrate) (MP3 Only) 81 | %\\ = vbr noiseshaping (1-3) (MP3 Only) 82 | %( = vbr stereomode (joint, stereo, mono, forced etc) (MP3 Only) 83 | %) = vbr unwise (1 = yes) (MP3 Only) 84 | %| = vbr source (<32.000Hz, 44.100Hz, 48.000Hz, >48.000Hz) (MP3 Only) 85 | # 86 | #### Movie AVI/MPG/MPEG/M2V cookies 87 | # 88 | %D = Width 89 | %E = Height 90 | %H = Frame rate (fps) 91 | %; = Aspect Ratio 92 | %: = Video Type (long) 93 | %, = Video Type (short) 94 | %` = Audio Hz 95 | %= = Audio Channels 96 | %> = Audio Type (name - AC3 etc) 97 | %< = Audio Type (code - 0x2000 etc) 98 | # 99 | # 100 | %J = RAR Compression method (!! SHOULD NOT BE USED ATM !!) 101 | 102 | 103 | 104 | ############# Cookies for user and group messages 105 | # 106 | #### User's 107 | # 108 | %u = Name 109 | %U = Name 110 | %G = Group 111 | %D = DayUp position 112 | %W = WkUp position 113 | %M = MonthUp position 114 | %A = AllUp position 115 | %F = Speed of fastest upload (use in fastestfilemsg) 116 | %S = Speed of slowest upload (use in fastestfilemsg) 117 | # 118 | #### Group's 119 | # 120 | %g = Name 121 | # 122 | #### Both 123 | # 124 | %n = rank 125 | %N = comment winner/loser 126 | %f = # of uploaded files 127 | %b = total bytes uploaded 128 | %k = total kilobytes uploaded 129 | %m = total megabytes uploaded 130 | %p = percent uploaded 131 | %s = speed (kb/sec) 132 | %% = % char 133 | 134 | NOTE: With cookies you can (and in some cases you need to) define accuracy (or string length), 135 | reserved bytes for variable by using them as: 136 | 137 | %.8u => "username" 138 | %.4u => "user" 139 | %12u => " username" 140 | %-12u => "username " 141 | 142 | %.0s => "1234" 143 | %.1s => "1234.5" 144 | %6.1s => "1234.5" 145 | %7.1s => " 1234.5" 146 | %-7.1s => "1234.5 " 147 | 148 | 149 | ############# Cookies for incomplete indicators 150 | # 151 | %0 = "/site/incoming/release/cd1" => release => basename(dirname(path)) 152 | %1 = "/site/incoming/release/cd1" => cd1 => basename(path) 153 | %2 = name of current stat_section, or DEFAULT if not found. 154 | %3 = "/site/incoming/release/cd1" => incoming => dir after sitepath_dir 155 | %% = %-sign 156 | 157 | 158 | ###### sitename 159 | # 160 | %Z = name of site, short form. 161 | 162 | ## 163 | -------------------------------------------------------------------------------- /INSTALL.cuftpd: -------------------------------------------------------------------------------- 1 | PZS-NG (Project-ZS - Next Generation) 2 | -------------------------------------- 3 | 4 | 5 | Important notes: 6 | ---------------- 7 | 8 | It's worth mentioning that compatability is _not_ 9 | complete. A few things are missing, the known ones 10 | are: 11 | - All/month/week/day-up/down stats in announces 12 | - Most triggers on IRC, the following WORKS: 13 | - !df/free 14 | - !bnc 15 | - !uptime 16 | - !inc/!incomplete(s) 17 | - Announces for logins/logouts and other 18 | siteop-related logging (i.e. security.log). 19 | 20 | In addition, while cuftpd works fine under Windows, 21 | pzs-ng does not. You might have luck compiling it 22 | using mingw32 or cygwin, but this is untested. If anyone 23 | attempts and succeeds at getting pzs-ng working under Windows, 24 | please let us know. :-) 25 | 26 | In short: Patches welcome! :-) 27 | 28 | 29 | Setting up pzs-ng under cuftpd: 30 | ------------------------------- 31 | 32 | Setting it up under cuftpd is very much like under glftpd, so read 33 | INSTALL too. The things you need to do, in short, is this: 34 | 35 | - Prepare pzs-ng for compilation, do this using 36 | ./configure --disable-glftpd-specific --with-install-path=/path/to/cuftpd/install 37 | 38 | - Edit zsconfig.h, the important thing to notice is that all paths must be ABSOLUTE and 39 | relative to the system root (NOT ftp-root), unlike glftpd. 40 | Example: 41 | Under glftpd: /site/incoming/videos 42 | Under cuftpd: /path/to/cuftpd/install/site/incoming/videos 43 | In addition, make sure these settings are set in zsconfig.h: log (path to cuftpd.log) and storage. 44 | 45 | - Compile and install like normal: 46 | make all install 47 | 48 | - Setting it up in cuftpd: 49 | - Edit cuftpd.xml, find under . 50 | - Set to 2 51 | - Find , under it set to /path/to/cuftpd/install/bin. 52 | (NOTE that you have to append '/bin' to the installation path used 53 | with ./configure) 54 | - Restart cuftpd! 55 | 56 | Setting up dZSbot under cuftpd: 57 | ------------------------------- 58 | 59 | This is identical as what is described in sitebot/README, except you need to set the paths 60 | to real paths, and you need to add one line to dZSbot.conf (IMPORTANT): 61 | set ftpd_type "other" 62 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2007, project-zs-ng team 2 | 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 6 | 7 | * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 8 | * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 9 | * Neither the name of the project-zs-ng team nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. 10 | 11 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 12 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 13 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 14 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 15 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 16 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 17 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 18 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 19 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 20 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 21 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 22 | -------------------------------------------------------------------------------- /Makefile.in: -------------------------------------------------------------------------------- 1 | prefix=@INSTALLPATH@ 2 | 3 | CFLAGS=-Wall -g 4 | CC=@CC@ 5 | LIBS=@LIBS@ 6 | INSTALL=@INSTALL@ 7 | 8 | all: zs bot @SITEWHO@ 9 | @(printf "\n\tProject-ZS-NG is now compiled!\n\tType 'make install' to install it into $(prefix).\n\n") 10 | 11 | install: all 12 | $(INSTALL) -m755 -d $(prefix)/bin 13 | cd zipscript/src ; $(MAKE) install 14 | if [ "x@SITEWHO@" != "x" ]; then cd sitewho ; $(MAKE) install; fi 15 | cd sitebot/src ; $(MAKE) install 16 | 17 | distclean: clean 18 | rm -f *~ config.cache config.log config.status config.h 19 | rm -rf autom4te.cache/ 20 | cd zipscript/src ; $(MAKE) distclean 21 | cd sitebot/src ; $(MAKE) distclean 22 | cd sitewho ; $(MAKE) distclean 23 | cd lib ; $(MAKE) distclean 24 | find . -name Makefile | xargs rm -f 25 | 26 | clean: 27 | find . -name '*.o' | xargs rm -f 28 | cd zipscript/src ; $(MAKE) clean 29 | cd sitebot/src ; $(MAKE) clean 30 | cd sitewho ; $(MAKE) clean 31 | cd lib ; $(MAKE) clean 32 | 33 | uninstall: 34 | cd zipscript/src ; $(MAKE) uninstall 35 | 36 | zs: libs 37 | @(printf "\n\033[1;37mGenerating ng-version: \033[0m") 38 | @(./version.sh) 39 | @(printf "\n\033[1;37mCompiling the zipscript\033[0m\n") 40 | cd zipscript/src ; $(MAKE) all 41 | 42 | bot: 43 | @(printf "\n\033[1;37mCompiling the bot binaries\033[0m\n") 44 | cd sitebot/src ; $(MAKE) all 45 | 46 | swho: 47 | @(printf "\n\033[1;37mCompiling the sitewho\033[0m\n") 48 | cd sitewho/ ; $(MAKE) all 49 | 50 | libs: 51 | @(printf "\n\033[1;37mCompiling the additional libraries\033[0m\n") 52 | cd lib/ ; $(MAKE) all 53 | 54 | utils: 55 | @(printf "\n\033[1;37mCompiling the extra utilities\033[0m\n") 56 | cd zipscript/utils ; $(MAKE) all 57 | 58 | strip: 59 | cd zipscript/src ; $(MAKE) strip 60 | cd sitewho ; $(MAKE) strip 61 | cd sitebot/src ; $(MAKE) strip 62 | 63 | -------------------------------------------------------------------------------- /README.AMD64: -------------------------------------------------------------------------------- 1 | NOTE! 2 | NOTE! This doc should now be obsolete! 3 | NOTE! pzs-ng will compile the bins with the correct 4 | NOTE! struct sizes necessary for 64bit processors. 5 | NOTE! 6 | 7 | 8 | Special notes for sitewho and ng-bw on the AMD64 platform 9 | --------------------------------------------------------- 10 | 11 | Because glftpd is compiled as 32-bit, the variable datatypes in the shared 12 | memory it allocates have different sizes from the corresponding 64-bit 13 | datatypes. This means that when sitewho and ng-bw are compiled as 64-bit and 14 | try to read the "struct ONLINE" that glftpd shares, they try to read it with 15 | the size it would be if it was 64-bit. 16 | 17 | To solve this, "-m32" is added to the Makefiles for sitewho and ng-bw. With 18 | this option, the binaries are compiled 32-bit instead of 64-bit. However, to 19 | be able to compile a 32-bit binary, you need 32-bit libraries to link against. 20 | Some distributions only include 64-bit libraries, so you will therefore need 21 | to install the 32-bit ones respectively. 22 | 23 | Below is a small list of distributions, and the necessary steps needed to make 24 | pzs-ng compile 32bit - as you can see, there's no "simple" way to find out 25 | what is needed. 26 | 27 | ubuntu: apt-get install make gcc ia32-libs lib32gcc1 lib32z1 lib32z1-dev libc6-dev libc6-dev-i386 libc6-i386 zlib1g-dev binutils cpp cpp-4.0 gcc-4.0 lib32stdc++6 linux-kernel-headers 28 | 29 | gentoo : emerge emul-linux-x86-compat emul-linux-x86-baselibs 30 | 31 | debian : apt-get install lib32gcc1 lib32stdc++6 ia32-libs lsb-release gcc-3.4 cpp-3.4 ia32-libs-dev 32 | rm /usr/bin/gcc && ln -s gcc-3.4 /usr/bin/gcc 33 | 34 | suse : 35 | 36 | fedora : 37 | 38 | slackware: should be fine, but may fail to compile if you recompile gcc with support for gcj (java). 39 | 40 | -------------------------------------------------------------------------------- /README.datacleaner: -------------------------------------------------------------------------------- 1 | 2 | datacleaner - short description: 3 | -------------------------------- 4 | datacleaner is a simple tool that recursively cleans out unused zipscript-c 5 | data. 6 | 7 | datacleaner - how to use: 8 | ------------------------- 9 | datacleaner run under chroot, which means you have several posibilities on 10 | how to run it. The best way is to run it once a day, as root using crontab. 11 | ----- 12 | 0 2 * * * /sbin/chroot /glftpd /bin/datacleaner >/dev/null 2>&1 13 | ----- 14 | replace path to chroot, and your glftpd rootdir accordingly. 15 | 16 | The other ways to use it is as a site command, 17 | ----- 18 | site_cmd ZSCLEAN /bin/datacleaner 19 | custom-zsclean 127ABCD 20 | ----- 21 | 22 | or as a cscript to. 23 | ----- 24 | cscript RMD post /bin/datacleaner 25 | cscript SITE[:space:]WIPE post /bin/datacleaner 26 | ----- 27 | 28 | Using it as a cscript may, or may not be such a great idea, since it will 29 | search the entire directory-tree under ftp-data/pzs-ng/site/* and check 30 | to see if the corresponding dir exists under site/*, ie, it can take time. 31 | 32 | datacleaner - why: 33 | ------------------ 34 | Why use it? Simple - the zipscript stores race-data in a 'mirror' of your 35 | site tree - after a while, this gets *huge*. Weird problems can occur when 36 | your computer runs out of storage, or when the filesystem gets too many 37 | files. You will also notice weird output on dupe uploads, ie, a release 38 | that was uploaded, has been deleted, and is uploaded anew. 39 | 40 | - Team PZS-NG 41 | 42 | -------------------------------------------------------------------------------- /README.mp3-genres: -------------------------------------------------------------------------------- 1 | Heres's a quick list of mp3 genres. 2 | 3 | A Cappella 4 | Acid Jazz 5 | Acid Punk 6 | Acid 7 | Acoustic 8 | Alt. Rock 9 | Alternative 10 | Ambient 11 | Anime 12 | Avantgarde 13 | Ballad 14 | Bass 15 | Beat 16 | Bebob 17 | Big Band 18 | Black Metal 19 | Bluegrass 20 | Blues 21 | Booty Bass 22 | BritPop 23 | Cabaret 24 | Celtic 25 | Chamber Music 26 | Chanson 27 | Chorus 28 | Christian Gangsta Rap 29 | Christian Rap 30 | Christian Rock 31 | Classic Rock 32 | Classical 33 | Club 34 | Club-House 35 | Comedy 36 | Contemporary Christian 37 | Country 38 | Crossover 39 | Cult 40 | Dance Hall 41 | Dance 42 | Darkwave 43 | Death Metal 44 | Disco 45 | Dream 46 | Drum & Bass 47 | Drum Solo 48 | Duet 49 | Easy Listening 50 | Electronic 51 | Ethnic 52 | Euro-House 53 | Euro-Techno 54 | Eurodance 55 | Fast-Fusion 56 | Folk Rock 57 | Folk 58 | Folklore 59 | Freestyle 60 | Funk 61 | Fusion 62 | Game 63 | Gangsta Rap 64 | Goa 65 | Gospel 66 | Gothic Rock 67 | Gothic 68 | Grunge 69 | Hard Rock 70 | Hardcore 71 | Heavy Metal 72 | Hip-Hop 73 | House 74 | Humour 75 | Indie 76 | Industrial 77 | Instrumental Pop 78 | Instrumental Rock 79 | Instrumental 80 | JPop 81 | Jazz 82 | Jazz+Funk 83 | Jungle 84 | Latin 85 | Lo-Fi 86 | Meditative 87 | Merengue 88 | Metal 89 | Musical 90 | National Folk 91 | Native American 92 | Negerpunk 93 | New Age 94 | New Wave 95 | Noise 96 | Oldies 97 | Opera 98 | Other 99 | Polka 100 | Polsk Punk 101 | Pop Funk 102 | Pop 103 | Pop-Folk 104 | Porn Groove 105 | Power Ballad 106 | Pranks 107 | Primus 108 | Progressive Rock 109 | Psychedelic Rock 110 | Psychedelic 111 | Punk Rock 112 | Punk 113 | R&B 114 | Rap 115 | Rave 116 | Reggae 117 | Retro 118 | Revival 119 | Rhythmic Soul 120 | Rock & Roll 121 | Rock 122 | Salsa 123 | Samba 124 | Satire 125 | Showtunes 126 | Ska 127 | Slow Jam 128 | Slow Rock 129 | Sonata 130 | Soul 131 | Sound Clip 132 | Soundtrack 133 | Southern Rock 134 | Space 135 | Speech 136 | Swing 137 | Symphonic Rock 138 | Symphony 139 | Synthpop 140 | Tango 141 | Techno 142 | Techno-Industrial 143 | Terror 144 | Thrash Metal 145 | Top 40 146 | Trailer 147 | Trance 148 | Tribal 149 | Trip-Hop 150 | Unknown 151 | Vocal 152 | 153 | -------------------------------------------------------------------------------- /README.sitewho: -------------------------------------------------------------------------------- 1 | SITEWHO: 2 | -------- 3 | sitewho is a binary that will show users online, and their current status. It 4 | is usually executed from a bot, where commands such as !bw and !speed are used. 5 | 6 | sitewho have 4 "modes": 7 | normal: list all users according to the sitewho.conf, along with header/tail 8 | files. 9 | --raw: list users in "raw" format - the output is made into cookies, which 10 | makes it easy for a bot to grab the specifics and format the output. 11 | --ss5: made specifically for the ss5 script by god-emper, this is similar to 12 | 'raw', just formatted a bit different. 13 | --nbw: List only the summary of bw used. 14 | 15 | sitewho may also be compiled with altwho, in which case the output may look 16 | a little different. Currently, altwho is the default in pzs-ng. 17 | 18 | 19 | SITEWHO.CONF: 20 | ------------- 21 | sitewho.conf should be placed in the same dir as the sitewho binary, and is read 22 | each time sitewho is called upon. Several options exists, which decide how the 23 | output will look. A small explanation is described inside the file. 24 | 25 | 26 | COMPILING: 27 | ---------- 28 | You should no longer need to compile sitewho from this location - everything is 29 | done from the main (root) dir of pzs-ng. 'make install' will copy the config, 30 | header and footer files along with the compiled bin into your glftpd setup. 31 | If the header/footer/config files are already present, 'make install' will NOT 32 | overwrite your copy of the files, so please make sure you have all options 33 | you need included in your local copy. 34 | 35 | -------------------------------------------------------------------------------- /TODO: -------------------------------------------------------------------------------- 1 | TODO is now deprecated. use http://bugs.pzs-ng.com/. 2 | (You can report bugs and classify them as features to add feature-requests) 3 | Thank you. :-) 4 | zipscript-c : // if (!strcomp(ignored_types, fname + ext_start) && !(strcomp(allowed_types, fname + ext_start) && matchpath(allowed_types_exemption_dirs, raceI->misc.current_path))) { 5 | - is this correct? Why is this commented? 6 | 7 | -------------------------------------------------------------------------------- /UPDATING: -------------------------------------------------------------------------------- 1 | UPDATING BETWEEN VERSIONS/REVISIONS 2 | ----------------------------------- 3 | 4 | There seems to be much confusion about updating. The general idea is as follows: 5 | 6 | Keep zsconfig.h and dZSbot.conf 7 | 8 | These are your config files. There is no need to redo the config files each time 9 | you update your zipscript/bot. I'll say again: THERE IS NO NEED TO REDO THE 10 | CONFIG FILES EACH TIME YOU UPGRADE. 11 | 12 | Okay, now that that is clear, here's the general process: 13 | 14 | 1. download/unpack the latest version/revision. 15 | 2. copy your old zsconfig.h into zipscript/conf/ 16 | 3. make distclean; ./configure && make && make install 17 | 3a. chmod +s /glftpd/bin/ng-chown (optional, only if you use it) 18 | 4. cp sitebot/dZSb* /path/to/sitebot/scripts/pzs-ng/ 19 | 5. .rehash or .restart your bot. 20 | 21 | Refer to sitebot/UPDATING when updating the sitebot. 22 | 23 | 24 | That's it! You've upgraded. 25 | Any new additions/changes to either the sitebot or the zipscript is used with 26 | default values - your bot/zipscript will not break. 27 | 28 | In case you're wondering about step 4 above - no, it will not overwrite your 29 | config - there is no dZSbot.conf in the archive. The above cp command is 30 | quite safe to use. 31 | 32 | Themes - these will be updated from time to time. Themes in general should 33 | continue to work as they always have. 34 | 35 | 36 | ANY CHANGES THAT DEVIATE FROM THE ABOVE IS LISTED BELOW. 37 | -------------------------------------------------------------------------------- 38 | 39 | zsconfig.h: The option 'del_progressmeter' has changed. Make sure you have 40 | two percentage signs '%%' in it. See README.ZSCONFIG for more 41 | info. Optionally, just remove the option from your config, and 42 | the default will be used. 43 | Changed in: r827 44 | 45 | The options 'cleanup_yesterday' and 'cleanup_today' is gone and 46 | is replaced by 'days_back_cleanup'. The option 'cleanupdirs' is 47 | split in two, 'cleanupdirs' and 'cleanupdirs_dated'. 48 | Changed in: r1273 49 | 50 | Default mode of sfv_cleanup_lowercase changed from FALSE to 51 | TRUE, and in effect will not differentiate on case. 52 | Changed in: r1348 53 | 54 | racedata changed. You *HAVE* *TO* rm -fR ftp-data/pzs-ng/*. 55 | Changed in: 1277, 1458, 1474, 1508, 1521, 1535, 2246 56 | 57 | 58 | dZSbot.conf A dZSbot.conf.defaults first appeared in r1120 - if your bot 59 | is older than this, it is recommended to update all, including 60 | dZSbot.conf 61 | 62 | 63 | -------------------------------------------------------------------------------- /aclocal.m4: -------------------------------------------------------------------------------- 1 | dnl aclocal.m4: macros autoconf uses when building configure from configure.ac 2 | dnl 3 | dnl Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004 Eggheads Development Team 4 | dnl 5 | dnl This program is free software; you can redistribute it and/or 6 | dnl modify it under the terms of the GNU General Public License 7 | dnl as published by the Free Software Foundation; either version 2 8 | dnl of the License, or (at your option) any later version. 9 | dnl 10 | dnl This program is distributed in the hope that it will be useful, 11 | dnl but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | dnl GNU General Public License for more details. 14 | dnl 15 | dnl You should have received a copy of the GNU General Public License 16 | dnl along with this program; if not, write to the Free Software 17 | dnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 | dnl 19 | dnl $Id: aclocal.m4,v 1.95 2004/08/21 00:16:55 wcc Exp $ 20 | dnl 21 | 22 | dnl SSL check taken from the eggdrop SSL patch 23 | 24 | dnl PZSNG_SSL() 25 | dnl 26 | AC_DEFUN(PZSNG_SSL, [dnl 27 | #ssl checks - hoe 28 | AC_MSG_CHECKING(whether to include SSL support) 29 | AC_ARG_WITH(ssl, 30 | [ --with-ssl[=PATH] Include SSL support (DIR is OpenSSL's install dir).], 31 | [ 32 | case "$withval" in 33 | no) 34 | AC_MSG_RESULT(no) ;; 35 | yes) 36 | AC_MSG_RESULT(yes) 37 | AC_CHECK_LIB(ssl,SSL_accept,[AC_DEFINE(PZSNG_SSL_EXT) 38 | SSL_LIBS="-lssl -lcrypto"],SSL_LIBS="",-lcrypto) 39 | 40 | ;; 41 | *) 42 | dnl A whole whack of possible places where this might be 43 | test -f $withval/openssl/ssl.h && SSL_INCLUDE="$withval" 44 | test -f $withval/include/openssl/ssl.h && SSL_INCLUDE="$withval/include" 45 | 46 | test -f $withval/lib/libssl.a && SSL_LIB="$withval/lib" 47 | test -f $withval/lib/ssl/libssl.a && SSL_LIB="$withval/lib/ssl" 48 | test -f $withval/lib/openssl/libssl.a && SSL_LIB="$withval/lib/openssl/ssl" 49 | test -f $withval/libssl.a && SSL_LIB="$withval" 50 | test -f $withval/ssl/libssl.a && SSL_LIB="$withval/ssl" 51 | test -f $withval/openssl/libssl.a && SSL_LIB="$withval/openssl" 52 | 53 | test -f $withval/lib/libcrypto.a && CRYPTO_LIB="$withval/lib" 54 | test -f $withval/lib/ssl/libcrypto.a && CRYPTO_LIB="$withval/lib/ssl" 55 | test -f $withval/lib/openssl/libcrypto.a && CRYPTO_LIB="$withval/lib/openssl/ssl" 56 | test -f $withval/libcrypto.a && CRYPTO_LIB="$withval" 57 | test -f $withval/ssl/libcrypto.a && CRYPTO_LIB="$withval/ssl" 58 | test -f $withval/openssl/libcrypto.a && CRYPTO_LIB="$withval/openssl" 59 | 60 | if test -n "$SSL_INCLUDE" && test -n "$SSL_LIB" && test -n "$CRYPTO_LIB"; then 61 | SSL_LIBS="-lssl -lcrypto -L$SSL_LIB -L$CRYPTO_LIB"; 62 | AC_DEFINE(PZSNG_SSL_EXT) 63 | AC_MSG_RESULT(yes) 64 | else 65 | AC_MSG_RESULT(no) 66 | SSL_LIBS=""; 67 | dnl AC_MSG_ERROR([You requested SSL support, but OpenSSL was not found. Please supply a pathname to OpenSSL]) 68 | fi ;; 69 | esac 70 | ],[ 71 | AC_MSG_RESULT(will try to find) 72 | AC_CHECK_LIB(ssl,SSL_accept,[AC_DEFINE(PZSNG_SSL_EXT) 73 | SSL_LIBS="-lssl -lcrypto"],SSL_LIBS="",-lcrypto) 74 | AC_CHECK_HEADERS(openssl/ssl.h,,SSL_INCLUDE="",) 75 | dnl AC_CHECK_HEADERS("openssl/ssl.h",,[AC_MSG_ERROR([OpenSSL was not found. Please supply a pathname to OpenSSL])],) 76 | dnl SSL_LIBS="-lssl -lcrypto"],[AC_MSG_ERROR([OpenSSL was not found. Please supply a pathname to OpenSSL])],-lcrypto) 77 | 78 | AC_SUBST(SSL_LIBS)dnl 79 | AC_SUBST(SSL_INCLUDE)dnl 80 | ]) 81 | 82 | #end of ssl checks - hoe (.16 by poci) 83 | ])dnl 84 | -------------------------------------------------------------------------------- /config.h.in: -------------------------------------------------------------------------------- 1 | /* config.h.in. Generated from configure.in by autoheader. */ 2 | 3 | /* Define to 1 if you have the header file, and it defines `DIR'. 4 | */ 5 | #undef HAVE_DIRENT_H 6 | 7 | /* Define to 1 if you have the header file. */ 8 | #undef HAVE_ERRNO_H 9 | 10 | /* Define to 1 if you have the header file. */ 11 | #undef HAVE_FCNTL_H 12 | 13 | /* Define to 1 if you have the header file. */ 14 | #undef HAVE_FLAC_FORMAT_H 15 | 16 | /* Define to 1 if you have the header file. */ 17 | #undef HAVE_FLAC_METADATA_H 18 | 19 | /* Define to 1 if you have the header file. */ 20 | #undef HAVE_FNMATCH_H 21 | 22 | /* Define to 1 if you have the header file. */ 23 | #undef HAVE_HSREGEX_H 24 | 25 | /* Define to 1 if you have the header file. */ 26 | #undef HAVE_INTTYPES_H 27 | 28 | /* Define to 1 if you have the header file. */ 29 | #undef HAVE_MEMORY_H 30 | 31 | /* Define to 1 if you have the header file, and it defines `DIR'. */ 32 | #undef HAVE_NDIR_H 33 | 34 | /* Define to 1 if you have the header file. */ 35 | #undef HAVE_OPENSSL_SSL_H 36 | 37 | /* Define to 1 if you have the header file. */ 38 | #undef HAVE_PWD_H 39 | 40 | /* Define to 1 if you have the header file. */ 41 | #undef HAVE_REGEX_H 42 | 43 | /* Define to 1 if you have the header file. */ 44 | #undef HAVE_STDINT_H 45 | 46 | /* Define to 1 if you have the header file. */ 47 | #undef HAVE_STDLIB_H 48 | 49 | /* Define to 1 if you have the header file. */ 50 | #undef HAVE_STRINGS_H 51 | 52 | /* Define to 1 if you have the header file. */ 53 | #undef HAVE_STRING_H 54 | 55 | /* Define to 1 if you have the strlcpy() function available */ 56 | #undef HAVE_STRLCPY 57 | 58 | /* Define to 1 if you have the header file, and it defines `DIR'. 59 | */ 60 | #undef HAVE_SYS_DIR_H 61 | 62 | /* Define to 1 if you have the header file. */ 63 | #undef HAVE_SYS_IPC_H 64 | 65 | /* Define to 1 if you have the header file, and it defines `DIR'. 66 | */ 67 | #undef HAVE_SYS_NDIR_H 68 | 69 | /* Define to 1 if you have the header file. */ 70 | #undef HAVE_SYS_PARAM_H 71 | 72 | /* Define to 1 if you have the header file. */ 73 | #undef HAVE_SYS_SHM_H 74 | 75 | /* Define to 1 if you have the header file. */ 76 | #undef HAVE_SYS_STAT_H 77 | 78 | /* Define to 1 if you have the header file. */ 79 | #undef HAVE_SYS_TIME_H 80 | 81 | /* Define to 1 if you have the header file. */ 82 | #undef HAVE_SYS_TYPES_H 83 | 84 | /* Define to 1 if you have the header file. */ 85 | #undef HAVE_SYS_UIO_H 86 | 87 | /* Define to 1 if you have the header file. */ 88 | #undef HAVE_SYS_WAIT_H 89 | 90 | /* Define to 1 if you have the header file. */ 91 | #undef HAVE_UNISTD_H 92 | 93 | /* Define to the address where bug reports for this package should be sent. */ 94 | #undef PACKAGE_BUGREPORT 95 | 96 | /* Define to the full name of this package. */ 97 | #undef PACKAGE_NAME 98 | 99 | /* Define to the full name and version of this package. */ 100 | #undef PACKAGE_STRING 101 | 102 | /* Define to the one symbol short name of this package. */ 103 | #undef PACKAGE_TARNAME 104 | 105 | /* Define to the home page for this package. */ 106 | #undef PACKAGE_URL 107 | 108 | /* Define to the version of this package. */ 109 | #undef PACKAGE_VERSION 110 | 111 | /* Define to 1 to if you have the required SSL-libs in place */ 112 | #undef PZSNG_SSL_EXT 113 | 114 | /* Define to 1 if you have the ANSI C header files. */ 115 | #undef STDC_HEADERS 116 | 117 | /* Define to 1 if you can safely include both and . */ 118 | #undef TIME_WITH_SYS_TIME 119 | -------------------------------------------------------------------------------- /lib/Makefile.in: -------------------------------------------------------------------------------- 1 | CFLAGS=-Wall -g 2 | CC=@CC@ 3 | LIBS=@LIBS@ 4 | 5 | all: strl_dir 6 | 7 | distclean: clean 8 | cd strl ; $(MAKE) distclean 9 | 10 | clean: 11 | cd strl ; $(MAKE) clean 12 | 13 | strl_dir: 14 | @(printf "\n\033[1;37mCompiling the strl lib\033[0m\n") 15 | cd strl ; $(MAKE) all 16 | -------------------------------------------------------------------------------- /lib/strl/Makefile.in: -------------------------------------------------------------------------------- 1 | CC=@CC@ 2 | CFLAGS=@CFLAGS@ @STATIC@ @NOFORMAT@ -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE @DEFS@ -I../include/ -I../../ 3 | LDFLAGS=@LDFLAGS@ 4 | 5 | all: strlcpy.o 6 | 7 | distclean: clean 8 | 9 | clean: 10 | 11 | -------------------------------------------------------------------------------- /lib/strl/strl.h: -------------------------------------------------------------------------------- 1 | #ifndef __STRL_H__ 2 | #define __STRL_H__ 3 | 4 | #include 5 | 6 | size_t strlcpy(char *, const char *, size_t); 7 | 8 | #endif 9 | -------------------------------------------------------------------------------- /lib/strl/strlcpy.c: -------------------------------------------------------------------------------- 1 | /* $OpenBSD: strlcpy.c,v 1.8 2003/06/17 21:56:24 millert Exp $ */ 2 | 3 | /* 4 | * Copyright (c) 1998 Todd C. Miller 5 | * 6 | * Permission to use, copy, modify, and distribute this software for any 7 | * purpose with or without fee is hereby granted, provided that the above 8 | * copyright notice and this permission notice appear in all copies. 9 | * 10 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 11 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 12 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 13 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 14 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 15 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 16 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 17 | */ 18 | 19 | #ifdef HAVE_CONFIG_H 20 | # include "config.h" 21 | #endif 22 | 23 | #ifndef HAVE_STRLCPY 24 | 25 | #if defined(LIBC_SCCS) && !defined(lint) 26 | static char *rcsid = "$OpenBSD: strlcpy.c,v 1.8 2003/06/17 21:56:24 millert Exp $"; 27 | #endif /* LIBC_SCCS and not lint */ 28 | 29 | #include "strl.h" 30 | #include 31 | 32 | /* 33 | * Copy src to string dst of size siz. At most siz-1 characters 34 | * will be copied. Always NUL terminates (unless siz == 0). 35 | * Returns strlen(src); if retval >= siz, truncation occurred. 36 | */ 37 | size_t 38 | strlcpy(char *dst, const char *src, size_t siz) 39 | { 40 | register char *d = dst; 41 | register const char *s = src; 42 | register size_t n = siz; 43 | 44 | /* Copy as many bytes as will fit */ 45 | if (n != 0 && --n != 0) { 46 | do { 47 | if ((*d++ = *s++) == 0) 48 | break; 49 | } while (--n != 0); 50 | } 51 | 52 | /* Not enough room in dst, add NUL and traverse rest of src */ 53 | if (n == 0) { 54 | if (siz != 0) 55 | *d = '\0'; /* NUL-terminate dst */ 56 | while (*s++) 57 | ; 58 | } 59 | 60 | return(s - src - 1); /* count does not include NUL */ 61 | } 62 | 63 | #endif /* HAVE_STRLCPY */ 64 | -------------------------------------------------------------------------------- /scripts/audio-genre/README: -------------------------------------------------------------------------------- 1 | AUDIO-GENRE 2 | ----------- 3 | 4 | pzs-ng allows you to change the uid/gid of files/dirs with a bin called ng-chown. 5 | By default this binary is disabled in all aspects. 6 | You may use it to change the groupname in a dirlisting to match the genre of an 7 | audio-release, by adding the following in your zsconfig.h: 8 | 9 | #define enable_audio_script TRUE 10 | #define audio_script "/bin/ng-chown" 11 | #define audio_script_cookies "0 0 0 1 0 1 - \"%w\" \"%?\"" 12 | #define allow_gid_change_in_ng_chown TRUE 13 | #define allow_dir_chown_in_ng_chown TRUE 14 | 15 | Please copy/paste the exact lines above. This will enable the audio-script, and 16 | make ng-chown able to modify the group id of the releasedir. 17 | 18 | You must also chmod +s ng-chown: 19 | chmod +s /glftpd/bin/ng-chown 20 | 21 | Last, you'll have to add the genres into glftpd's groupfile. This is what the 22 | script named audio-genre-create.sh does. Just run it and it will modify the group 23 | file (after creating a backup). 24 | 25 | For those wanting an explanation of the cookies/variables passed: 26 | 0 - uid set to 0 - this disable the uid setting. 27 | 0 - gid set to 0 - this disable the gid setting. 28 | 0 - do not change uid of files/dirs. We only wants to change group. 29 | 1 - change gid of the file/dirs. 30 | 0 - do not change ownership of files in a dir we specify. 31 | 1 - change ownership of dir/file we specify. 32 | - - disable user name lookup. 33 | \"%w\" - genre name used as group-name. This will be used since gid = 0 34 | earlier. We use quotes since the name may have space chars. 35 | \"%?\" - current path - this is the dir we wish to chown. 36 | 37 | -------- 38 | SOOO... WHAT'S THE USE OF THIS? 39 | 40 | Well, changing the gid of an audio-dir to the genre allows you to easily sort dirs 41 | accordingly. Somesites only allow certain genres, or does not allow some. To the 42 | rescue comes this little handt script. :) Make your curries/leechers happy. 43 | 44 | -------------------------------------------------------------------------------- /scripts/audio-genre/audio-genre-create.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | ################################################ 4 | # Please do not edit below # 5 | ################################################ 6 | 7 | audiogenres="A cappella 8 | Acid 9 | Acid Jazz 10 | Acid Punk 11 | Acoustic 12 | Alternative 13 | AlternRock 14 | Ambient 15 | Anime 16 | Avantgarde 17 | Ballad 18 | Bass 19 | Beat 20 | Bebob 21 | Big Band 22 | Black Metal 23 | Bluegrass 24 | Blues 25 | Booty Bass 26 | BritPop 27 | Cabaret 28 | Celtic 29 | Chamber Music 30 | Chanson 31 | Chorus 32 | Christian Gangsta Rap 33 | Christian Rap 34 | Christian Rock 35 | Classic Rock 36 | Classical 37 | Club 38 | Club House 39 | Comedy 40 | Contemporary Christian 41 | Country 42 | Crossover 43 | Cult 44 | Dance 45 | Dance Hall 46 | Darkwave 47 | Death Metal 48 | Disco 49 | Dream 50 | Drum & Bass 51 | Drum Solo 52 | Duet 53 | Easy Listening 54 | Electronic 55 | Ethnic 56 | Euro-House 57 | Euro-Techno 58 | Eurodance 59 | Fast Fusion 60 | Folk 61 | Folk-Rock 62 | Folklore 63 | Freestyle 64 | Funk 65 | Fusion 66 | Game 67 | Gangsta 68 | Goa 69 | Gospel 70 | Gothic 71 | Gothic Rock 72 | Grunge 73 | Hard Rock 74 | Hardcore 75 | Heavy Metal 76 | Hip-Hop 77 | House 78 | Humour 79 | Indie 80 | Industrial 81 | Instrumental 82 | Instrumental Pop 83 | Instrumental Rock 84 | Jazz 85 | Jazz+Funk 86 | JPop 87 | Jungle 88 | Latin 89 | Lo-Fi 90 | Meditative 91 | Merengue 92 | Metal 93 | Musical 94 | National Folk 95 | Native American 96 | Negerpunk 97 | New Age 98 | New Wave 99 | Noise 100 | Oldies 101 | Opera 102 | Other 103 | Polka 104 | Polsk Punk 105 | Pop 106 | Pop-Folk 107 | Pop_Funk 108 | Porn Groove 109 | Power Ballad 110 | Pranks 111 | Primus 112 | Progressive Rock 113 | Psychedelic 114 | Psychedelic Rock 115 | Punk 116 | Punk Rock 117 | R&B 118 | Rap 119 | Rave 120 | Reggae 121 | Retro 122 | Revival 123 | Rhythmic Soul 124 | Rock 125 | Rock & Roll 126 | Salsa 127 | Samba 128 | Satire 129 | Showtunes 130 | Ska 131 | Slow Jam 132 | Slow Rock 133 | Sonata 134 | Soul 135 | Sound Clip 136 | Soundtrack 137 | Southern Rock 138 | Space 139 | Speech 140 | Swing 141 | Symphonic Rock 142 | Symphony 143 | Synthpop 144 | Tango 145 | Techno 146 | Techno-Industrial 147 | Terror 148 | Thrash Metal 149 | Top 40 150 | Trailer 151 | Trance 152 | Tribal 153 | Trip-Hop 154 | Unknown 155 | Vocal" 156 | 157 | possible_glroot_paths="/glftpd /jail/glftpd /usr/glftpd /usr/jail/glftpd /usr/local/glftpd /usr/local/jail/glftpd /$HOME/glftpd /glftpd/glftpd /opt/glftpd" 158 | if [ $# -eq 0 ]; then 159 | for possible_glroot in $possible_glroot_paths; do 160 | if [ -e ${possible_glroot}/etc/group ]; then 161 | glroot=${possible_glroot} 162 | break 163 | fi 164 | done 165 | 166 | if [ -z ${glroot} ]; then 167 | echo "" 168 | echo "Usage: $0 /path/to/glftpd-root-dir" 169 | echo "" 170 | exit 0 171 | fi 172 | else 173 | glroot=$1 174 | if [ ! -e /$glroot/etc/group ]; then 175 | echo "" 176 | echo "Oops! I think you wrote wrong path. I can't find" 177 | echo "$glroot/etc/group - Exiting." 178 | exit 0 179 | fi 180 | fi 181 | 182 | groupfile=$glroot/etc/group 183 | 184 | echo "This program fills glftpd's group file with valid audio-genre names." 185 | echo "This is needed to be able to use the ng-chown script as an audio-genre script." 186 | echo "" 187 | echo "groupfile to edit: $groupfile" 188 | echo "" 189 | echo "press to continue, or to break off." 190 | read line 191 | echo "making backup of $groupfile -> $groupfile.bak" 192 | cp $groupfile $groupfile.bak 193 | echo "Working..." 194 | 195 | IFSBAK="$IFS" 196 | IFS=" 197 | " 198 | 199 | for genreorig in $audiogenres; do 200 | genre="`echo "$genreorig" | tr ' ' '_'`" 201 | if [ -z "`grep -e "^$genre:" $groupfile`" ]; then 202 | gid=`tail -n 1 $groupfile | cut -d ':' -f 3` 203 | let gid=gid+100 204 | echo "$genre:$genre:$gid:AUDIO-GENRE" >> $groupfile 205 | echo "Adding genre '$genre' with gid '$gid'" 206 | fi 207 | done 208 | 209 | IFS=$IFSBAK 210 | 211 | echo "" 212 | echo "To make use of the audio genres, add the following in you zsconfig.h:" 213 | echo "" 214 | echo "#define enable_audio_script TRUE" 215 | echo "#define audio_script \"/bin/ng-chown\"" 216 | echo "#define audio_script_cookies \"0 0 0 1 0 1 - \\\"%w\\\" \\\"%?\\\"\"" 217 | echo "#define allow_gid_change_in_ng_chown TRUE" 218 | echo "#define allow_dir_chown_in_ng_chown TRUE" 219 | echo "" 220 | echo "Then 'make install' as usual, and chmod +s ng-chown:" 221 | echo " chmod +s $glroot/bin/ng-chown" 222 | echo "" 223 | echo "A backup of the original groupfile is located at:" 224 | echo " $groupfile.bak" 225 | exit 0 226 | 227 | -------------------------------------------------------------------------------- /scripts/cleaner/README: -------------------------------------------------------------------------------- 1 | This script removes dead symlinks in current dir, and the dir(s) 2 | just below. Should be used as a site command, or as a cscript. 3 | glftpd.docs has info on how to add custom commands and cscripts. 4 | 5 | 6 | -------------------------------------------------------------------------------- /scripts/cleaner/cleaner.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | for file in * ; do 4 | if [ ! -e "$file" ] ; then 5 | echo "Removing $file..." 6 | rm -f "$file" 7 | fi 8 | if [ -d "$file" ]; then 9 | cd "$file" 10 | for underfile in * ; do 11 | if [ ! -e "$underfile" ] ; then 12 | echo "Removing $underfile..." 13 | rm -f "$underfile" 14 | fi 15 | done 16 | cd .. 17 | fi 18 | done 19 | 20 | -------------------------------------------------------------------------------- /scripts/debug_checker/debug_checker.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Tiny script that goes thru the .debug files, searching for crashes. 4 | ### 5 | 6 | debug=".debug" 7 | storage="/glftpd/ftp-data/pzs-ng/" 8 | 9 | ## END OF CONFIG 10 | 11 | proc_chkdebug() { 12 | ignorepid=$(head -n 1 "$1" | cut -d' ' -f7) 13 | 14 | cnt=0 15 | lastpid=0 16 | 17 | grep -E "( - create_lock: lock set| - remove_lock: queue)" "$1" | cut -d' ' -f7 | sort | while read pid; do 18 | if [ "$pid" = "$ignorepid" ]; then continue; fi 19 | let "odd = $cnt % 2" 20 | if [ "$odd" = 1 ]; then 21 | if [ ! "$pid" = "$lastpid" ]; then 22 | echo "check pid $lastpid in $1" 23 | echo "listing last three lines below:" 24 | grep -e " $lastpid - " $1 | tail -n 3 25 | cnt=0 26 | fi 27 | fi 28 | let "cnt += 1" 29 | lastpid=$pid 30 | done 31 | } 32 | 33 | find $storage -name "$debug" | while read line; do 34 | proc_chkdebug "$line" 35 | done 36 | 37 | -------------------------------------------------------------------------------- /scripts/debug_checker/wrapper.README: -------------------------------------------------------------------------------- 1 | WHAT IS IT? 2 | ----------- 3 | This util is only for debugging purposes. If a binary crash, this wrapper will 4 | force it to coredump. This file is needed by the devs to find out why the bin 5 | crashed. 6 | If you use it and want help, please send the core file and the bin that created 7 | it to one of the devs. 8 | 9 | HOW TO USE: 10 | ----------- 11 | copy wrapper.sh to /glftpd/bin/ and rename it to .sh - is the 12 | name of the binary you wish to debug, like zipscript-c or postdel. 13 | 14 | chmod +x /glftpd/bin/.sh 15 | 16 | edit glftpd.conf, and change to .sh 17 | 18 | 19 | Example - you wish to debug postdel. 20 | 21 | cp wrapper.sh /glftpd/bin/postdel.sh 22 | chmod +x /glftpd/bin/postdel.sh 23 | 24 | in glftpd.conf, change: 25 | cscript DELE post /bin/postdel 26 | to: 27 | cscript DELE post /bin/postdel.sh 28 | 29 | send the corefile (usually found in the releasedir, and named either .core or 30 | postdel.core) along with the postdel binary to the devs. 31 | 32 | 33 | -------------------------------------------------------------------------------- /scripts/debug_checker/wrapper.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | ulimit -c unlimited 3 | binary="${0%%.sh}" 4 | exec $binary "$@" 5 | 6 | -------------------------------------------------------------------------------- /scripts/logtrimmer/README: -------------------------------------------------------------------------------- 1 | A simple and basic script to trim logs. Should 2 | be run in crontab. 3 | 4 | -------------------------------------------------------------------------------- /scripts/logtrimmer/logtrimmer.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # config # 4 | ########## 5 | 6 | # Where do I find your logs? 7 | logdir=/glftpd/ftp-data/logs 8 | 9 | # Enter here the names of the logs you wish trimmed. 10 | # The format is: :<# of lines to keep> 11 | logfiles="error.log:500 glftpd.log:1000 login.log:100 request.log:100 xferlog:1000" 12 | today="`date +"%a %b %d %H:%M:%S %Y"`" 13 | 14 | ################# 15 | # end of config # 16 | 17 | for logline in $logfiles; do 18 | logfile=`echo $logline | cut -d ':' -f 1` 19 | loglines=`echo $logline | cut -d ':' -f 2` 20 | tail -n $loglines ${logdir}/${logfile} > ${logdir}/${logfile}.temp 21 | echo "$today -- Logfile turned over --" >> ${logdir}/${logfile}.temp 22 | cat ${logdir}/${logfile}.temp > ${logdir}/${logfile} 23 | rm -f ${logdir}/${logfile}.temp 24 | done 25 | 26 | -------------------------------------------------------------------------------- /scripts/nfoextract/complete_script_wrapper.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | /bin/nfoextract.sh $@ 3 | /bin/nfoextract2.sh $@ 4 | exit 0 5 | -------------------------------------------------------------------------------- /scripts/nfoextract/nfoextract.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | ###################################################### 3 | # PSXC's GetNFO v0.5b (get_nfo.sh - nfoextract.sh) # 4 | # # 5 | # History: # 6 | # v0.5b - changed some code which i didn't # 7 | # understand the meaning of. # 8 | # v0.5a - added support for a different file than # 9 | # the default .message # 10 | # v0.5 - more bugs fixed # 11 | # v0.4 - small bug fixed (hopefully) # 12 | # added debug support for sfv releases # 13 | # v0.3 - removed support for chown'ing of file. # 14 | # added support for extraction of file_id.diz # 15 | # added chmod'ing of file_id.diz # 16 | # fixed a bug re: subdir in unzip list # 17 | # v0.2 - added support for a better nfo extraction. # 18 | # added comments and how-to-use. # 19 | # added some config. # 20 | # v0.1 - First release. # 21 | #################################################################################################### 22 | # 23 | # How to use: 24 | # 25 | # This script should be run after the release is complete. Meant for d1's 26 | # Project-ZS v0.6.x, edit the following in zsconfig.h: 27 | # 28 | # #define enable_complete_script TRUE 29 | # #define complete_script "/bin/nfoextract.sh" 30 | # 31 | # Then deny *.nfo uploads in your 0day dirs. Here is an example with the 32 | # default precheck.sh (replace 0DAY with the name of your 0day dir): 33 | # 34 | # *.[nN][fF][oO]) 35 | # if [ ! "`echo $2 | grep 0DAY`" = "" ]; then 36 | # echo -e ".---=== GetNFO v0.5b =====--- psxc (C)2004 --====--.\n| NFO file uploads denied. |\n| The .nfo will instead be extracted from the zip. |\n\`--------=======-----------------=====-------------'\n" 37 | # exit 2 38 | # fi 39 | # ;; 40 | # 41 | # copy nfoextract.sh to glftpd's bin directory (/glftpd/bin) and make sure you have the following 42 | # in glftpd's bin directory: bash chmod chown unzip ls echo cat 43 | # 44 | #################################################################################################### 45 | 46 | ########## 47 | # config # 48 | ########## 49 | # do you want the .nfo extracted to .message? 50 | copy_to_message=1 51 | 52 | # name of .message 53 | name_message=.message 54 | 55 | # add debug info? 56 | # 0 = disable debug 57 | # 1 = use file 58 | # 2 = use .message 59 | debug=0 60 | 61 | ################# 62 | # end of config # 63 | ################# 64 | 65 | found=0 66 | nfocount=`ls -1 2>/dev/null | grep "\.[Nn][Ff][Oo]$"` 67 | if [ -z "$nfocount" ] ; then 68 | files=`ls -1 2> /dev/null | grep "\.[Zz][Ii][Pp]$"` 69 | for file in $files; do 70 | nfocount=`ls -1 2> /dev/null | grep "\.[Nn][Ff][Oo]$"` 71 | if [ -z "$nfocount" ] ; then 72 | /bin/unzip -l $file | { 73 | while read Length Date Time Name; do 74 | if [ ! -z "`echo $Name | grep "\.[Nn][Ff][Oo]$"`" ]; then 75 | if [ ! $found = 1 ]; then 76 | found=1 77 | New_Name=`echo $Name | tr '/' '\n' | grep -v "^$" | tail -n 1 | tr '[:upper:]' '[:lower:]'` 78 | /bin/unzip -Cqqp $file $Name > $New_Name 79 | if [ ! "$copy_to_message" = "0" ]; then 80 | echo "" >> $name_message 81 | echo "content of $New_Name:" >> $name_message 82 | echo "" >> $name_message 83 | cat $New_Name >> $name_message 84 | fi 85 | /bin/chmod 644 $New_Name 86 | if [ -z `ls -1 2>/dev/null | grep "[Ff][Ii][Ll][Ee]_[Ii][Dd]\.[Dd][Ii][Zz]"` ]; then 87 | /bin/unzip -Cqqp $file file_id.diz > file_id.diz 88 | fi 89 | if [ -e file_id.diz ]; then 90 | /bin/chmod 644 file_id.diz 91 | fi 92 | fi 93 | fi 94 | done 95 | } 96 | fi 97 | done 98 | fi 99 | if [ ! $debug -eq 0 ]; then 100 | if [ ! -z "`ls -1 2>/dev/null | grep "\.[Ss][Ff][Vv]$"`" ]; then 101 | a=0 102 | sfv_file=`ls -1 2>/dev/null | grep "\.[Ss][Ff][Vv]$" | head -1` 103 | for b in `cat $sfv_file | cut -d " " -f1`; do 104 | if [ -e $b ]; then 105 | let "a = a + 1" 106 | else 107 | noop=1 108 | fi 109 | done 110 | if [ $debug -eq 1 ]; then 111 | if [ ! "`ls -1 | grep "^\.files_uploaded"`" = "" ]; then 112 | rm -f .files_uploaded* 113 | fi 114 | touch .files_uploaded_$a 115 | else 116 | if [ ! "`cat $name_message | grep "^files_uploaded"`" = "" ]; then 117 | cat $name_message | awk '{ if ($1 == "files_uploaded") print "debug: num of files has changed"; else print }' > $name_message.tmp 118 | rm -f $name_message 119 | mv $name_message.tmp $name_message 120 | echo "files_uploaded : $a" >> $name_message 121 | else 122 | echo " " >> $name_message 123 | echo "files_uploaded : $a" >> $name_message 124 | fi 125 | fi 126 | # echo -e "Files uploaded so far: $a" 127 | fi 128 | fi 129 | exit 0 130 | 131 | -------------------------------------------------------------------------------- /scripts/obsolete/getnfo2.0.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/glftpd/pzs-ng/92dc5509d268ba69022f4a104f70ec164fc581c1/scripts/obsolete/getnfo2.0.tar.gz -------------------------------------------------------------------------------- /scripts/obsolete/psxc-rescan_v0.2.tgz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/glftpd/pzs-ng/92dc5509d268ba69022f4a104f70ec164fc581c1/scripts/obsolete/psxc-rescan_v0.2.tgz -------------------------------------------------------------------------------- /scripts/precheck/pre_check.tcl: -------------------------------------------------------------------------------- 1 | #!/bin/tclsh 2 | # version: 9/07022002 3 | ## fix up puts "#0bleh" 4 | 5 | if {[llength $argv] != 2} {puts "Invalid arguments passed to script!" ; exit 2} 6 | 7 | set misc(echo) 1 8 | set dir(glroot) "" 9 | set dir(exempt) "/site/requests/* /site/private/*" 10 | set dir(ziponly) "/site/0day/*" 11 | set files(exempt) "" 12 | set files(delete) "*.diz" 13 | set files(unique) "{SFV *.\[ss\]\[fF\]\[vV\]}" 14 | set files(chksfv) "*.\[rR\]\[aA\]\[rR\] *.\[mM\]\[pP\]3 *.\[rR0-9\]\[0-9\]\[0-9\]" 15 | set files(naming) "{4 *.\[zZ\]\[iI\]\[pP\]}" 16 | 17 | proc checkpath {path} { 18 | if {![file readable $path]} { 19 | echo "Bitch at the sysop, because he has\nabsolutely no idea how to setup this script!" ; exit 0 20 | } 21 | } 22 | 23 | proc checksfv {sfvfile upfile} { 24 | set value 0 25 | if {[catch {set sfvfile [open $sfvfile r]}] != 0} {exit 0} 26 | foreach line [split [read $sfvfile] "\n"] { 27 | set entry [lindex [join [join [split [split $line "\$"] "\""]]] 0] 28 | if {[string index $entry 0] == ";"} {continue} 29 | if {[string match -nocase $entry $upfile]} {set value 1 ; break} 30 | } 31 | close $sfvfile 32 | return $value 33 | } 34 | 35 | proc echo {string} { 36 | global misc 37 | if {$misc(echo)} {puts $string} 38 | } 39 | proc findfiles {pattern} {return [glob -nocomplain -type f $pattern]} 40 | 41 | set file [lindex $argv 0] ; set path [lindex $argv 1] ; set fullpath "$dir(glroot)$path" 42 | checkpath $fullpath 43 | 44 | if {[info exists dir(exempt)]} { 45 | foreach entry $dir(exempt) { 46 | if {[string match -nocase $entry $path]} {exit 0} 47 | } 48 | } 49 | 50 | if {[info exists files(exempt)]} { 51 | foreach entry $files(exempt) { 52 | if {[string match -nocase $entry $file]} {exit 2} 53 | } 54 | } 55 | 56 | if {[info exists files(delete)]} { 57 | foreach entry $files(delete) { 58 | if {[string match -nocase $entry $file]} {exit 2} 59 | } 60 | } 61 | 62 | if {[info exists dir(ziponly)]} { 63 | foreach entry $dir(ziponly) { 64 | if {[string match -nocase $entry $fullpath] && ![string match -nocase "*.zip" $file]} {exit 2} 65 | } 66 | } 67 | 68 | if {[info exists files(unique)]} { 69 | foreach entry $files(unique) { 70 | if {[llength $entry] != 2} {continue} 71 | set type [lindex $entry 0] ; set pattern [lindex $entry 1] 72 | if {![string match -nocase $pattern $file]} {continue} 73 | set matches [findfiles $fullpath/$pattern] 74 | if {[llength $matches] == 0} {break} 75 | foreach entry $matches { 76 | if {[file size $entry] == 0} {file delete --force $entry ; break} 77 | } 78 | echo "File rejected! $type file already exist!" ; exit 2 79 | } 80 | } 81 | 82 | if {[info exists files(chksfv)]} { 83 | foreach entry $files(chksfv) { 84 | if {![string match -nocase $entry $file]} {continue} 85 | set mainfile [findfiles $fullpath/*.\[ss\]\[fF\]\[vV\]] 86 | if {[llength $mainfile] == 0} {echo "You must upload a sfv first!" ; exit 2} 87 | if {[llength $mainfile] != 1} {echo "Can't check the sfv since multiple files were found!" ; exit 0} 88 | if {[checksfv $mainfile $file]} {exit 0} 89 | echo "File does not exist in sfv!" ; exit 2 90 | } 91 | } 92 | 93 | if {[info exists files(naming)]} { 94 | foreach entry $files(naming) { 95 | if {[llength $entry] != 2} {continue} 96 | set chars [lindex $entry 0] ; set pattern [lindex $entry 1] 97 | if {![string match -nocase $pattern $file]} {continue} 98 | set mainfile [file tail [lindex [findfiles $fullpath/$pattern] 0]] 99 | if {$mainfile == ""} {exit 0} 100 | set x 0 ; set pattern "" 101 | while {$x < $chars} { 102 | append pattern [string index $mainfile $x] 103 | incr x 104 | } 105 | append pattern "*" 106 | if {[string match -nocase $pattern $file]} {exit 0} 107 | echo "Filename does not match with existing disks" ; exit 2 108 | } 109 | } 110 | 111 | exit 0 112 | -------------------------------------------------------------------------------- /scripts/psxc-imdb/FILES: -------------------------------------------------------------------------------- 1 | PSXC-IMDB FILES: 2 | ---------------- 3 | 4 | CHANGELOG - List of changes made between releases. 5 | FAQ - Frequently Asked Questions. 6 | FILES - List of files included. 7 | README - Instructions on setup, needed files etc. 8 | TODO - Your requests, future plans. 9 | UPGRADING - What needs to be done to upgrade your install. 10 | main/ 11 | - psxc-imdb.sh - Main script. (chmod 755) 12 | - psxc-imdb-bot.tcl - botscript. (chmod 644) 13 | - psxc-imdb.conf - main configfile. (chmod 644) 14 | - psxc-imdb-conf.tcl - tcl configfile. (chmod 644) 15 | addons/ - Directory with addons, aka EXTERNALSCRIPT. 16 | - psxc-imdb-nuker.sh - An auto nuker/logger/nuke warner. 17 | - psxc-symlink-maker.sh - A symlink maker used to sort releases based on 18 | imdb score, genres, title, year or release group. 19 | - psxc-imdb-dotimdb.pl - A replacement-formatter for the standard .imdb. 20 | extras/ - Directory with example-files and other helpful things. 21 | - psxc-imdb-sanity.sh - Checks your setup. 22 | - psxc-imdb-rescan.sh - A site_cmd script used to rescan for imdb info. 23 | - psxc-imdb-parser.sh - An example script which helps you create your own 24 | addons. 25 | - psxc-imdb-find.sh - A script used to find imdb-info based on name. 26 | Mostly used in conjunction with psxc-imdb-find.tcl. 27 | other/ - Directory with other stuff for the imdb-script. 28 | diff/ - Directory with diff-files. Useful for patching 29 | your own modified files, or checking what's 30 | changed. 31 | 32 | -------------------------------------------------------------------------------- /scripts/psxc-imdb/README.installer: -------------------------------------------------------------------------------- 1 | PSXC-IMDB Installer 2 | ------------------- 3 | 4 | This script will do basic installation/reinstallation/upgrading of 5 | psxc's imdb script. 6 | 7 | It should be fairly simple, really. The installer will ask you a 8 | few questions, modify the install-files to match your setup, and 9 | then copy the files to where they are supposed to be. For each 10 | file copied, it will give you the opportunity to edit the config 11 | of the file, or just check that it looks a-okay according to your 12 | setup. 13 | If you already have files installed, it will give you the option 14 | of either replacing the file, trying to patch it, or keep the 15 | original one as it is. If the file is patched or replaced, the 16 | original file will be backed up. 17 | Please take note that the earliest version supported on patching 18 | is v2.0i. If you have an older version, patching will fail. 19 | 20 | - psxc 21 | 22 | -------------------------------------------------------------------------------- /scripts/psxc-imdb/README.psxc-imdb-dotimdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/glftpd/pzs-ng/92dc5509d268ba69022f4a104f70ec164fc581c1/scripts/psxc-imdb/README.psxc-imdb-dotimdb -------------------------------------------------------------------------------- /scripts/psxc-imdb/README.psxc-imdb-find: -------------------------------------------------------------------------------- 1 | psxc-imdb-find is a addon to psxc-imdb, which will give your bot !imdb 2 | capability. It means that the users in your channel can look up imdb info 3 | just by writing !imdb . 4 | 5 | To set this up you need a working bot, and psxc-imdb should be installed. 6 | You then have two choices - use dZSbot.tcl to handle the output (default) 7 | or have the bot-addon handle it (the "full" mode). 8 | 9 | Using "full" mode: 10 | ------------------ 11 | This is a bit deceptive. You do not need to have everything logged by the 12 | script handled by the bot-addon, even in "full" mode. It just means that it 13 | will poll a logfile, and output everything logged in that file. Using "full" 14 | mode and setting it up to poll glftpd.log is *NOT* recommended - use a 15 | different logfile for this. 16 | To have !imdb lookups handled by the bot-addon, do the following: 17 | 18 | 1. edit psxc-imdb.conf - check PSXCFINDLOG. 19 | - ignore FINDTRIGGER. 20 | - check FINDLOGFORMAT - this must be "". 21 | 22 | 2. edit psxc-imdb-conf.tcl - set psxc(IMDBMOVIE) to the same file as 23 | PSXCFINDLOG. 24 | - set psxc(FINDTRIG) to whatever you like. 25 | - set psxc(FINDSCRIPT) to the correct path. 26 | - set psxc(USEFULL) to "YES" 27 | - set psxc(USEFIND) to "YES" 28 | 29 | 3. run psxc-imdb-sanity.sh. 30 | 31 | 4. restart your bot. 32 | 33 | 34 | Using dZSbot.tcl: 35 | ----------------- 36 | This describes how to set things up using dZSbot.tcl. 37 | 38 | 1. edit psxc-imdb.conf - check PSXCFINDLOG 39 | - check FINDTRIGGER 40 | - check FINDLOGFORMAT 41 | 42 | 2. edit psxc-imdb-conf.tcl - set psxc(FINDTRIG) to whatever you like. 43 | - set psxc(FINDSCRIPT) to the correct path. 44 | - set psxc(USEFIND) to "YES" 45 | 46 | 3. copy the file to glftpd's bin dir: 47 | cp psxc-imdb-find.sh /glftpd/bin/ 48 | 49 | 4. edit dZSbot.tcl: 50 | 51 | In this example I use "IMDBFIND" as a keyword. It doesn't matter what you name 52 | it, as long as it's not something you've used before. 53 | 54 | - add "IMDBFIND" to "msgtypes(DEFAULT)" 55 | set msgtypes(DEFAULT) "IMDBFIND MSGINVITE BADMSGINVITE INVITE LOGIN LOGOUT" 56 | 57 | - add "IMDBFIND" to the disable list 58 | set disable(IMDBFIND) 0 59 | 60 | - add "IMDBFIND" to chanlist 61 | set chanlist(IMDBFIND) "#mychannel" 62 | 63 | - add "IMDBFIND" to variables 64 | set variables(FIND) "%pf %msg" 65 | 66 | - add "IMDBFIND" to announce 67 | set announce(FIND) "-%sitename- %bold\[IMDB\]%bold - %msg" 68 | 69 | Take note on what you put FINDTRIGGER and FINDLOGFORMAT to, and act 70 | accordingly. Setting these to anything but the defaults ("") require 71 | some knowledge on dZSbot.tcl - read up on it in README.use.of.special.format. 72 | 73 | Also note that it's possible to use other methods than this, but this setup 74 | should work for most people. 75 | 76 | 5. restart your bot. 77 | 78 | Things should now just work. 79 | 80 | If you wish to find out what to do to get your own formatted output, read 81 | README.use.of.special.format 82 | 83 | - psxc 84 | 85 | -------------------------------------------------------------------------------- /scripts/psxc-imdb/TODO: -------------------------------------------------------------------------------- 1 | PSXC-IMDB TODO: 2 | --------------- 3 | 4 | remove .imdbinfofile (etc) 5 | imdb.sh: add something to announce debug mode on. 6 | add even more example configs in the perl addon. 7 | add support for tvtome in the -find addon (or a new addon). 8 | 9 | -------------------------------------------------------------------------------- /scripts/psxc-imdb/addons/psxc-imdb-dotimdb.pl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/glftpd/pzs-ng/92dc5509d268ba69022f4a104f70ec164fc581c1/scripts/psxc-imdb/addons/psxc-imdb-dotimdb.pl -------------------------------------------------------------------------------- /scripts/psxc-imdb/addons/psxc-symlink-maker.sh: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/glftpd/pzs-ng/92dc5509d268ba69022f4a104f70ec164fc581c1/scripts/psxc-imdb/addons/psxc-symlink-maker.sh -------------------------------------------------------------------------------- /scripts/psxc-imdb/extras/psxc-imdb-parser.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Bash is very limited in formatting output. You'd do better in perl or some 4 | # other "real" language. But since this is just an example, I'll do this in 5 | # what most people manages to read. The script in itself is not important - 6 | # the variables are, since I expect you to experiment a bit with this.. 7 | # If you manage to create a decent script which formats in a generic way, 8 | # and don't mind spreading the wealth, please send it to me so I can include 9 | # it. 10 | # 11 | VERSION=2.5 12 | 13 | IFSORIG=$IFS 14 | IFS="^" 15 | 16 | # Initialize variables. bash is a bit limited, so we gotta do a "hack" 17 | c=1 18 | for a in `echo $@ | sed "s|\" \"|^|g"`; do 19 | b[c]=$a 20 | let c=c+1 21 | done 22 | 23 | IFS=$IFSORIG 24 | 25 | # Give the variables some sensible names 26 | IMDBDATE=${b[1]} 27 | IMDBDOTFILE=${b[2]} 28 | IMDBRELPATH=${b[3]} 29 | IMDBDIRNAME=${b[4]} 30 | IMDBURL=${b[5]} 31 | IMDBTITLE=${b[6]} 32 | IMDBGENRE=${b[7]} 33 | IMDBRATING=${b[8]} 34 | IMDBCOUNTRY=${b[9]} 35 | IMDBLANGUAGE=${b[10]} 36 | IMDBCERTIFICATION=${b[11]} 37 | IMDBRUNTIME=${b[12]} 38 | IMDBDIRECTOR=${b[13]} 39 | IMDBBUSINESSDATA=${b[14]} 40 | IMDBPREMIERE=${b[15]} 41 | IMDBLIMITED=${b[16]} 42 | IMDBVOTES=${b[17]} 43 | IMDBSCORE=${b[18]} 44 | IMDBNAME=${b[19]} 45 | IMDBYEAR=${b[20]} 46 | IMDBNUMSCREENS=${b[21]} 47 | IMDBISLIMITED=${b[22]} 48 | IMDBCASTLEADNAME=${b[23]} 49 | IMDBCASTLEADCHAR=${b[24]} 50 | IMDBTAGLINE=${b[25]} 51 | IMDBPLOT=${b[26]} 52 | IMDBBAR=${b[27]} 53 | IMDBCASTING=${b[28]} 54 | IMDBCOMMENTSHORT=${b[29]} 55 | IMDBCOMMENTFULL=${b[30]} 56 | 57 | ######################################################################### 58 | # From here on you should just paste/format the output to your liking. 59 | 60 | # 61 | # enter your code here.... 62 | # 63 | 64 | # 65 | ######################################################################### 66 | # You should always exit with a 0 - the parent won't give a crap anyway, 67 | # but just to make sure... 68 | exit 0 69 | 70 | -------------------------------------------------------------------------------- /scripts/psxc-imdb/main/old/psxc-imdb-conf.tcl: -------------------------------------------------------------------------------- 1 | ####################### 2 | # PSXC-IMDB bot-addon # 3 | # ------------------- 4 | # Tcl is really not my strong suit, so do not be surprised if your computer 5 | # blows up when you run this script. 6 | # 7 | # This little thingy can be used instead of adding stuff to crontab. It does 8 | # basically the same thing, only this will react instantly on .nfo uploads. 9 | # It may also be used instead of your normal bot config to output stuff in 10 | # (one) channel. 11 | # 12 | # edit the (not so) advanced config below, then copy this script to your bot's 13 | # script directory and add the following to your eggdrop.conf: 14 | # 15 | # source scripts/psxc-imdb-bot.tcl 16 | # 17 | 18 | ################### 19 | ##### config ###### 20 | 21 | # location of psxc-imdb.log file (aka IMDBLOG) 22 | set psxc(IMDBLOG) "/glftpd/ftp-data/logs/psxc-imdb.log" 23 | 24 | # location of the imdb-script 25 | set psxc(IMDBSCRIPT) "/glftpd/bin/psxc-imdb.sh" 26 | 27 | # location of psxc-moviedata.log file (aka GLLOG) 28 | # used only in "full" mode, where this addon will do all 29 | # imdb-output to channel. 30 | # !! DO NOT USE glftpd.log HERE !! 31 | set psxc(IMDBMOVIE) "/glftpd/ftp-data/logs/psxc-moviedata.log" 32 | 33 | # announce-channel(s) - separate by space 34 | # used only in "full" mode. 35 | set psxc(IMDBCHANNEL) "#changethis" 36 | 37 | # should the lines start with something? 38 | # used only in "full" mode. 39 | set psxc(IMDBTRIG) "\002IMDB:\002" 40 | 41 | # location of the .log file used for pre'ing 42 | set psxc(PRELOG) "/glftpd/ftp-data/logs/glftpd.log" 43 | #set psxc(PRELOG) "/glftpd/ftp-data/logs/prelog" 44 | 45 | # location of the imdb-pre-script. Normally, this is a symlink 46 | # to psxc-imdb.sh. 47 | set psxc(PRESCRIPT) "/glftpd/bin/psxc-imdb-pre.sh" 48 | 49 | # What do you wish to use as a channel trigger to react to 50 | # questions about a movie? 51 | set psxc(FINDTRIG) "!imdb" 52 | 53 | # Where is the find script (full path) 54 | set psxc(FINDSCRIPT) "/glftpd/bin/psxc-imdb-find.sh" 55 | 56 | # This char is used to split lines on output. It should be the 57 | # same variable you have in psxc-imdb-conf (NEWLINE). 58 | set psxc(NEWLINE) "|" 59 | 60 | ##### 61 | # this is where you enable/disable the parts of the script. 62 | 63 | # Should the script be used to output imdb-info? Normally 64 | # you set this to "YES" 65 | set psxc(USEBOT) "YES" 66 | 67 | # Should the script handle imdb-output? Normally dZsbot.tcl 68 | # handles output, but in some cases that doesn't work. This was 69 | # before known as "full" mode. 70 | # You also set this to "YES" if you wish this addon to handle 71 | # all !imdb requests. 72 | set psxc(USEFULL) "NO" 73 | 74 | # Is pre-support wanted? 75 | set psxc(USEPRE) "YES" 76 | 77 | # Do you wish to answer to !imdb requests? Please read 78 | # psxc-imdb-find.README before setting this to YES. 79 | # Also REMOVE psxc-imdb-find.tcl from your eggdrop.conf if 80 | # you used it! 81 | set psxc(USEFIND) "YES" 82 | # 83 | 84 | ##### 85 | # I know a lot of admins dislike the "<[psxc-imdb.sh] " 86 | # process - I strongly suggest you get used to it, but if you 87 | # cannot, set this variable to YES - it will force the bot to wait 88 | # for the script to finish. FYI - this can lead to a slow 89 | # responding/freezing bot, it may die on occation, it may become 90 | # very unstable in fact. But, you're free to test. 91 | set psxc(NODEFUNCT) "NO" 92 | 93 | ##### config done ##### 94 | ####################### 95 | 96 | -------------------------------------------------------------------------------- /scripts/psxc-imdb/main/psxc-imdb.sh: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/glftpd/pzs-ng/92dc5509d268ba69022f4a104f70ec164fc581c1/scripts/psxc-imdb/main/psxc-imdb.sh -------------------------------------------------------------------------------- /scripts/psxc-imdb/main/psxc-imdb.zpt: -------------------------------------------------------------------------------- 1 | ############################################################################## 2 | # # 3 | # psxc-imdb.zpt - IMDb: Movie Info Pzs-ng Plug-in (Default Theme) # 4 | # # 5 | ############################################################################## 6 | 7 | announce.IMDB = "%msg" 8 | announce.IMDBVAR = "[%b{imdb }][%section] %b{%imdbname} (%imdburl), a %imdbdirector movie which scored %b{%imdbscore of 10} (%imdbvotes people voted). It premiered in %imdbpremiereinfo, with %b{%imdbnumscreens screens} on the opening weekend.\n%b{%sitename} :: [%b{imdb }][%section] %b{%imdbname} plot summary: %imdbplot [%imdbbar]" 9 | announce.IMDBFIND = "%msg" 10 | announce.IMDBFINDVAR = "[%b{imdb }] %b{%imdbname}, a %imdbdirector movie which scored %b{%imdbscore of 10} (%imdbvotes people voted). It premiered in %imdbpremiereinfo, with %b{%imdbnumscreens screens} on the opening weekend.\n[%b{imdb }] %b{%imdbname} plot summary: %imdbplot [%imdbbar]" 11 | -------------------------------------------------------------------------------- /scripts/psxc-imdb/other/makeclean.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # This small thingy is useful when you wish to strip away blank lines 4 | # and comments from a file. It takes one argument - the file you 5 | # wish to strip/make clean. It will output the result to STDOUT 6 | 7 | if [ ! -z "$1" ]; then 8 | echo "## stripping file: $1" 9 | echo "##" 10 | cat $1 | awk '/#!/ , /# [Ee][Nn][Dd] [Oo][Ff] [Cc][Oo][Nn][Ff][Ii][Gg]/' | grep -v "^#" | sed -e /^$/d 11 | if [ "$?" = "0" ]; then 12 | echo "##" 13 | echo "## command completed successfully." 14 | else 15 | echo "##" 16 | echo "## command failed." 17 | fi 18 | else 19 | echo "## usage: $0 filename" 20 | fi 21 | exit 0 22 | -------------------------------------------------------------------------------- /scripts/psxc-imdb/other/makediff.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # This thingy will make .diffs. It's what I use when I do. 4 | # There is really no need for you to run this - it's just 5 | # here to let people using diffs see how they're done. 6 | # If my method could be improved, I'd like to know. I have 7 | # no experience in making diffs like this. 8 | # - psxc 9 | 10 | AV="2.0i 2.0j 2.0k 2.1 2.2 2.2f 2.3 2.3f 2.4" 11 | BV=2.5 12 | 13 | # End of config 14 | B=psxc-imdb_v$BV 15 | if [ ! -e $B/diff ]; then 16 | mkdir $B/diff 17 | fi 18 | for E in $AV; do 19 | D="psxc-imdb.sh psxc-imdb.conf psxc-imdb-bot.tcl psxc-imdb-conf.tcl psxc-imdb-parser.sh psxc-imdb-sanity.sh psxc-imdb-rescan.sh psxc-imdb-find.sh psxc-imdb-nuker.sh psxc-symlink-maker.sh psxc-imdb-dotimdb.pl" 20 | A=psxc-imdb_v$E 21 | for C in $D; do 22 | AX=`find $A -name $C` 23 | BX=`find $B -name $C` 24 | if [ $AX ] && [ $BX ]; then 25 | diff -b -B -c -C 2 $AX $BX > $B/diff/$C.patch.$E.$BV 26 | if [ ! -s $B/diff/$C.patch.$E.$BV ]; then 27 | rm $B/diff/$C.patch.$E.$BV 28 | fi 29 | fi 30 | done 31 | done 32 | 33 | -------------------------------------------------------------------------------- /scripts/psxc-imdb/other/psxc-depcheck_v0.1.tgz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/glftpd/pzs-ng/92dc5509d268ba69022f4a104f70ec164fc581c1/scripts/psxc-imdb/other/psxc-depcheck_v0.1.tgz -------------------------------------------------------------------------------- /scripts/psxc-imdb/other/stripcr.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | if [ $# -ne 1 ]; then 4 | echo "Strip CR - removes from files." 5 | echo "usage: $? " 6 | exit 0 7 | fi 8 | tmp="`cat $1 | tr -d ' '`" 9 | echo "$tmp" >$1 10 | 11 | 12 | -------------------------------------------------------------------------------- /scripts/psxc-trailer/CHANGELOG: -------------------------------------------------------------------------------- 1 | v 0.1 - inital build - not publicly released. 2 | v 0.2 - first public release. 3 | v 0.3 - added support for subdirs and "intelligent" choosing of what releases to scan. 4 | v 0.4 - added fix for linux. added support for sentralized trailerdir. 5 | v 0.5 - fixed a bug affecting Tropic Thunder (among others). 6 | - added option to download to both releasedir and trailerdir. 7 | v 0.7 - changed 'sedflags' to 'wgetflags' (i must've been high naming that variable) 8 | - added '-U "Internet Explorer"' to the list of wgetflags 9 | v 0.8 - modified the script to handle some new obfuscation in the url-hiding scheme. 10 | v 0.9 - added support for downloading all availible trailers of a movie in the 11 | specified quality. 12 | v 0.10 - better search for movies. Added fix made by oliveroms. 13 | v 0.11 - some regexp improvements. Added support for spaces in dirnames. 14 | v 0.12 - apple.com changed some requirements, which broke the script. fixed. 15 | v 0.13 - small typo and bug in the latest 0.12 - fixed. 16 | v 0.14 - fixed a small bug with year exclusion. Added better accuracy lookups. 17 | 18 | -------------------------------------------------------------------------------- /sitebot/UPDATING: -------------------------------------------------------------------------------- 1 | ngBot - UPDATING 2 | Project Zipscript - Next Generation (www.pzs-ng.com) 3 | (Based on dZSbot by Dark0n3 - http://kotisivu.raketti.net/darkone/) 4 | 5 | -------------------------------------------------------------------------------- 6 | Updating 7 | -------------------------------------------------------------------------------- 8 | 9 | Before attempting to update please read ../CHANGELOG. For any further help 10 | please see section 3. Resources in the README file. 11 | 12 | - Copy and replace the ngBot base files: 13 | cp -fR ngBot.* modules /path/to/eggdrop/pzs-ng/ 14 | 15 | - Manually copy plugins & themes to keep your current settings. 16 | -------------------------------------------------------------------------------- /sitebot/cookies-file-generator.tcl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/tclsh 2 | 3 | source ngBot.conf.defaults 4 | source ngBot.conf.dist 5 | source ngBot.vars 6 | 7 | puts "Quickreference of cookies:" 8 | puts " (ANNOUNCES) " 9 | puts "##########################" 10 | puts "## Read %u_ as 'User'" 11 | puts "## Read %g_ as 'Group'" 12 | puts "## Read %t_ as 'Total'" 13 | puts "" 14 | 15 | foreach var [lsort -ascii [array names "variables"]] { 16 | if {[lindex $variables($var) 0] == "%pf"} { 17 | set variables($var) [lreplace $variables($var) 0 0] 18 | } 19 | puts "# $var:" 20 | set vars [split $variables($var)] 21 | regsub -all {[{}]} $vars "" vars 22 | while {[llength $vars]} { 23 | set str [lindex $vars 0] 24 | set vars [lreplace $vars 0 0] 25 | while {[string length $str] < 80 && [llength $vars]} { 26 | set str [concat "$str," [lindex $vars 0]] 27 | set vars [lreplace $vars 0 0] 28 | } 29 | puts $str 30 | } 31 | # puts "[join [lsort -ascii [split $variables($var)]] ", "]" 32 | puts "" 33 | } 34 | -------------------------------------------------------------------------------- /sitebot/extra/incomplete-list.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | ############################## 4 | # CONFIG # 5 | # ^^^^^^ # 6 | ############################## 7 | 8 | # enter path glftpd is installed in. 9 | glroot=/glftpd 10 | 11 | # enter path to the cleanup binary. 12 | cleanup=$glroot/bin/cleanup 13 | 14 | # enter sections in the following format: 15 | # : 16 | # newline separates sections. 17 | sections=" 18 | 0DAY:/site/incoming/0day/ 19 | GAMES:/site/incoming/games/ 20 | APPS:/site/incoming/apps/ 21 | MV:/site/incoming/musicvideos/ 22 | " 23 | 24 | # alternative, set the following variable to point to your ngBot.conf or 25 | # other file where you have your section paths defined and uncomment the 26 | # "botconf=" directive below. 27 | #botconf=/path/to/sitebot/pzs-ng/ngBot.conf 28 | 29 | # set this to 1 if you wish to announce sections where no incompletes are found. 30 | verbose=0 31 | 32 | #bold char 33 | bold="" 34 | 35 | # set this to zero if you have sections in subdirs of one another - ie, 36 | # if you have defined in $sections "A:/site/DIR" and "B:/site/DIR/SUBDIR" 37 | no_strict=0 38 | 39 | ############################# 40 | # END OF CONFIG # 41 | # ^^^^^^^^^^^^^ # 42 | ############################# 43 | 44 | # grab sections from the sitebot's conf instead 45 | if [ ! -z "$botconf" ] && [ -e "$botconf" ]; then 46 | sections="`grep "^set paths(" $botconf | sed 's/^set paths(\(.*\))[[:space:]]\{1,\}\"\(.*\)\*\"/\1:\2/'`" 47 | fi; 48 | 49 | IFSORIG="$IFS" 50 | IFS=" 51 | " 52 | cleanupresults="`$cleanup $glroot 2>/dev/null | grep -e "^Incomplete" | tr '\"' '\n' | tr -s '/'`" 53 | for section in $sections; do 54 | secname="`echo "$section" | cut -d ':' -f 1`" 55 | secpaths="`echo "$section" | cut -d ':' -f 2- | tr ' ' '\n'`" 56 | 57 | for secpath in $secpaths; do 58 | results="`echo "$cleanupresults" | grep -e "$glroot$secpath"`" 59 | if [ -z "$results" ]; then 60 | if [ $verbose -eq 1 ]; then 61 | echo "$secname: No incomplete releases found." 62 | fi 63 | else 64 | for result in $results; do 65 | percent="`ls -1 "$result/" | sed -n 's/[^0-9]*\([0-9][0-9]*%\).*/\1/p'` complete" 66 | 67 | if [ $percent == " complete" ]; then 68 | percent="incomplete" 69 | fi 70 | 71 | # check for overlapping section paths 72 | # so we don't announce twice 73 | pass=1 74 | if [ $no_strict -eq 0 ]; then 75 | for sctn in $sections; do 76 | scpths="`echo "$sctn" | cut -d ':' -f 2- | tr ' ' '\n'`" 77 | for scpth in $scpths; do 78 | if [ "$secpath" != "$scpth" ] && [ "`echo "$scpth" | grep "^$secpath/"`" ]; then 79 | pass=0 80 | break 81 | fi 82 | done 83 | if [ $pass -eq 0 ]; then 84 | break 85 | fi 86 | done 87 | fi 88 | 89 | if [ $no_strict -eq 1 ] || [ $pass -eq 1 ]; then 90 | sedpath=`echo "$glroot$secpath/" | tr -s '/'` 91 | secrel="`echo $result | sed "s|$sedpath||" | tr -s '/'`" 92 | echo "$secname: ${bold}${secrel}${bold} is $percent." 93 | fi 94 | done 95 | fi 96 | done 97 | done 98 | echo "No more incompletes found." 99 | IFS="$IFSORIG" 100 | -------------------------------------------------------------------------------- /sitebot/extra/invite.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | log="/ftp-data/logs/glftpd.log" 4 | 5 | if [ -z "$1" ] || [ ! -z "$2" ] ; then 6 | printf "\nUsage: SITE INVITE \n\n" 7 | exit 0 8 | fi 9 | 10 | badchars=$(printf "%s" "$1" | tr -d "[a-z][A-Z][0-9]|\-_^][") 11 | if [ ! -z "$badchars" ]; then 12 | printf "\nERROR - Invalid characters in nick: %s\n\n" "$badchars" 13 | exit 0 14 | fi 15 | 16 | printf "%s INVITE: \"%s\" \"%s\" \"%s\" \"%s\" \"%s\"\n" "$(/bin/date '+%a %b %d %T %Y')" "$1" "$USER" "$GROUP" "$FLAGS" "$TAGLINE" >> "$log" 17 | printf "\nInvited %s with nick %s\n\n" "$USER" "$1" 18 | -------------------------------------------------------------------------------- /sitebot/extra/ng-topic.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | gllog="/ftp-data/logs/glftpd.log" 4 | channel=$1 5 | topic=`echo $@ | sed "s/$1 //g"` 6 | if [ "$channel" == "#chan" ]; then 7 | echo `date "+%a %b %e %T %Y"` SETTOPIC: \"$channel\" \"$topic\" >> $gllog 8 | echo "Sent topic ($topic) to $channel" 9 | else 10 | echo "Usage: site topic " 11 | fi -------------------------------------------------------------------------------- /sitebot/modules/cuftpd.tcl: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | # 3 | # ngBot - cuftpd FTP Module 4 | # Project Zipscript - Next Generation (www.pzs-ng.com) 5 | # (Based on dZSbot by Dark0n3 - http://kotisivu.raketti.net/darkone/) 6 | # 7 | ################################################################################ 8 | 9 | namespace eval ::ngBot::module::cuftpd { 10 | variable ns [namespace current] 11 | variable np [namespace qualifiers [namespace parent]] 12 | variable renames [list init_binaries] 13 | 14 | namespace export * 15 | 16 | proc init {} { 17 | variable np 18 | variable renames 19 | 20 | foreach name $renames { 21 | rename ${np}::$name ${np}::_$name 22 | } 23 | 24 | namespace inscope $np { 25 | namespace import -force ::ngBot::module::cuftpd::* 26 | } 27 | } 28 | 29 | proc init_binaries {} { 30 | variable np 31 | variable ${np}::bnc 32 | 33 | catch {unset bnc(CURL) bnc(DF) bnc(INCOMPLETE) bnc(PING) bnc(UPTIME)} 34 | } 35 | 36 | proc deinit {} { 37 | variable ns 38 | variable renames 39 | 40 | foreach name $renames { 41 | if {[llength [info commands "${np}::_$name"]] == 1} { 42 | catch {rename ${np}::$name {}} 43 | catch {rename ${np}::_$name ${np}::$name} 44 | } 45 | } 46 | 47 | namespace delete $ns 48 | } 49 | } -------------------------------------------------------------------------------- /sitebot/modules/example.tcl: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | # 3 | # ngBot - Example FTP Module 4 | # Project Zipscript - Next Generation (www.pzs-ng.com) 5 | # (Based on dZSbot by Dark0n3 - http://kotisivu.raketti.net/darkone/) 6 | # 7 | ################################################################################ 8 | 9 | namespace eval ::ngBot::module::example { 10 | variable ns [namespace current] 11 | # References the base namespace (the parents parent to be precise) ::ngBot. 12 | variable np [namespace qualifiers [namespace parent]] 13 | # List of procs we want to rename and replace with our own. The originals 14 | # can be chain loaded if need be. 15 | variable renames [list init_ng readlog] 16 | 17 | # Export all proc's. 18 | namespace export * 19 | 20 | proc init {} { 21 | variable np 22 | variable renames 23 | 24 | # Rename procs so we can chain load them later. 25 | foreach name $renames { 26 | rename ${np}::$name ${np}::_$name 27 | } 28 | 29 | # Run this code in the scope of the base namespace ::ngBot. 30 | # Because this is being run in a different scope, make sure the variables 31 | # you're using are available. Don't use ${np} or ${ns} for instance. 32 | namespace inscope $np { 33 | # All imported procs will still run within their original namespace. 34 | # Import more or less just adds pointers to the original procs. 35 | namespace import -force ::ngBot::module::example::* 36 | } 37 | } 38 | 39 | proc init_ng {type} { 40 | variable ns 41 | variable np 42 | # Example of how to reference variables in the base from an ftpd module. 43 | variable ${np}::sitename 44 | 45 | putlog "\[ngBot\] $sitename :: Loaded ftpd module: [namespace tail $ns]." 46 | 47 | # Chain load the original init_ng proc. 48 | ${np}::_init_ng $type 49 | } 50 | 51 | # deinit will be called by the base namespace ::ngBot automaticly when needed. 52 | # Removes the need to create a bind for the prerehash EVNT in every plugin. 53 | proc deinit {} { 54 | variable ns 55 | variable np 56 | variable renames 57 | # Example of how to reference variables in the base from an ftpd module. 58 | variable ${np}::sitename 59 | 60 | # Revert the renames we did earlier. Using .rehash wont reload some base 61 | # eggdrop/tcl procs, only .reset will. 62 | foreach name $renames { 63 | if {[llength [info commands "${np}::_$name"]] == 1} { 64 | catch {rename ${np}::$name {}} 65 | catch {rename ${np}::_$name ${np}::$name} 66 | } 67 | } 68 | 69 | putlog "\[ngBot\] $sitename :: Unloaded ftpd module: [namespace tail $ns]." 70 | } 71 | 72 | # readlog is run every second by a timer. 73 | proc readlog {} { 74 | variable np 75 | variable ${np}::sitename 76 | 77 | putlog "\[ngBot\] $sitename :: Readlog proc called" 78 | 79 | # Chain load the original readlog proc. 80 | ${np}::_readlog 81 | } 82 | } -------------------------------------------------------------------------------- /sitebot/ngBot.help: -------------------------------------------------------------------------------- 1 | %b{%sitename Command Help:} 2 | %cmdprehelp - This help message 3 | %cmdprebnc - Shows active bouncers 4 | %cmdprefree - Displays free space on site 5 | %cmdpreinc - Shows incomplete releases 6 | %cmdprebw - Shows site bandwidth 7 | %cmdpreleechers - Displays current downloaders 8 | %cmdpreuploaders - Displays current uploaders 9 | %cmdprespeed - Displays the status of 10 | %cmdprewho - Displays who is online 11 | %cmdprenew [section] - Displays latest releases 12 | %cmdprenukes [section] - Displays latest nukes 13 | %cmdpreunnukes [section] - Displays latest unnukes 14 | %cmdpresearch - Search for a release 15 | %cmdprealldn [stat section] - Shows top alltime downloaders 16 | %cmdpreallup [stat section] - Shows top alltime uploaders 17 | %cmdpredaydn [stat section] - Shows top day downloaders 18 | %cmdpredayup [stat section] - Shows top day uploaders 19 | %cmdpremonthdn [stat section] - Shows top month downloaders 20 | %cmdpremonthup [stat section] - Shows top month uploaders 21 | %cmdprewkdn [stat section] - Shows top week downloaders 22 | %cmdprewkup [stat section] - Shows top week uploaders 23 | %cmdpregpad [stat section] - Shows top downloading groups of alltime 24 | %cmdpregpau [stat section] - Shows top uploading groups of alltime 25 | %cmdpregpwu [stat section] - Shows top uploading groups of the week 26 | %cmdpregpwd [stat section] - Shows top downloading groups of the week 27 | %cmdpregpmd [stat section] - Shows top downloading groups of the month 28 | %cmdpregpmu [stat section] - Shows top uploading groups of the month 29 | %cmdpregpdd [stat section] - Shows top downloading groups of the day 30 | %cmdpregpdu [stat section] - Shows top uploading groups of the day 31 | Sections: %sections 32 | Stat Sections: %statsections 33 | -------------------------------------------------------------------------------- /sitebot/obsolete/bnccheck.tcl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/tclsh 2 | #log using ssl ? [0/1] 3 | set ssl 1 4 | 5 | set ip 127.0.0.1 6 | 7 | #good port 8 | set port 443 9 | 10 | #bad port 11 | set port1 4444 12 | 13 | set user "sitebot" 14 | set pass "b0t.be.i" 15 | 16 | #ssl support 17 | if { $ssl == 1 } { 18 | package require tls 19 | tls::init 20 | } 21 | 22 | proc ftpcheck {host port user pass} { 23 | global ssl 24 | set timeout "false" 25 | if { [catch { socket -async $host $port } sock ] } { 26 | return "Error: Connection Refused" 27 | } 28 | fconfigure $sock -translation lf -buffering line 29 | 30 | set start [clock clicks -milli] 31 | while {[flush $sock] == "" && [fblocked $sock]} { 32 | if {[clock clicks -milli] > $start + 5000} { 33 | close $sock 34 | return "Errror: Timeout" 35 | set timeout true; break 36 | } 37 | } 38 | if { $timeout != "true" } { 39 | while {![eof $sock]} { 40 | if { [catch { gets $sock } line ] } { 41 | return "Error: Connection problem" 42 | } 43 | puts "$line" 44 | set numeric [string trim [lindex [split $line] 0] "-"] 45 | if {[string trim $numeric "0123456789"] != ""} {set numeric "" } 46 | switch $numeric { 47 | 220 { 48 | if { $ssl == 1 } { 49 | puts "AUTH TLS" ; puts $sock "AUTH TLS" ; flush $sock 50 | } else { 51 | puts "USER $user" ; puts $sock "USER $user" ; flush $sock; 52 | } 53 | } 54 | 234 { tls::import $sock; flush $sock;puts "USER $user" ; puts $sock "USER $user" ; flush $sock } 55 | 331 { puts "PASS $pass" ; puts $sock "PASS $pass" ; flush $sock } 56 | 230 { close $sock ; return "logged in" } 57 | 530 { close $sock ; return "failed login -user" } 58 | default { close $sock ; return "failed login" } 59 | } 60 | } 61 | } 62 | close $sock 63 | } 64 | puts "ftpcheck: checking bnc ftp://$user:$pass@$ip:$port1 should fail" 65 | puts [ ftpcheck $ip $port1 $user $pass ] 66 | puts "" 67 | puts "ftpcheck: checking bnc ftp://$user:$pass@$ip:$port should succede" 68 | puts [ ftpcheck $ip $port $user $pass ] 69 | -------------------------------------------------------------------------------- /sitebot/obsolete/cookie-parsing.tcl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/tclsh 2 | # 3 | # - ParseCookies (by neoxed) 4 | # 5 | # Description: 6 | # Based on dark0n3's project-zs convert() function, this TCL procedure will 7 | # substitute all cookies with the list of values in the input string. 8 | # 9 | # Parameters: 10 | # InputStr - Input string to be parsed. 11 | # ValueList - Values to be replaced (the order coincides with the CookieList parameter). 12 | # CookieList - Cookie names (see above comment). 13 | # 14 | # Returns: 15 | # The formatted string with all cookies substituted and formatted accordingly. 16 | # 17 | proc ParseCookies {InputStr ValueList CookieList} { 18 | set InputLen [string length $InputStr] 19 | set OutputStr "" 20 | 21 | for {set InputIdx 0} {$InputIdx < $InputLen} {incr InputIdx} { 22 | if {[string index $InputStr $InputIdx] == "%"} { 23 | ## Save this index for invalid cookies 24 | set StartIdx $InputIdx 25 | 26 | ## Find position field 27 | set BeforeIdx [incr InputIdx] 28 | if {[string index $InputStr $InputIdx] == "-"} { 29 | ## Ignore the negative sign if a does not number follow, for example: %-(cookie) 30 | if {[string is digit -strict [string index $InputStr [incr InputIdx]]]} {incr InputIdx} else {incr BeforeIdx} 31 | } 32 | while {[string is digit -strict [string index $InputStr $InputIdx]]} {incr InputIdx} 33 | if {$BeforeIdx != $InputIdx} { 34 | set RightPos [string range $InputStr $BeforeIdx [expr {$InputIdx - 1}]] 35 | } else { 36 | set RightPos 0 37 | } 38 | 39 | ## Find minimum/precision field 40 | if {[string index $InputStr $InputIdx] == "."} { 41 | set BeforeIdx [incr InputIdx] 42 | ## Ignore the negative sign, for example: %.-(cookie) 43 | if {[string index $InputStr $InputIdx] == "-"} {incr BeforeIdx; incr InputIdx} 44 | while {[string is digit -strict [string index $InputStr $InputIdx]]} {incr InputIdx} 45 | if {$BeforeIdx != $InputIdx} { 46 | set LeftPos [string range $InputStr $BeforeIdx [expr {$InputIdx - 1}]] 47 | } else { 48 | set LeftPos 0 49 | } 50 | } else { 51 | ## TCL's [format ...] function doesn't accept -1 for the minimum field 52 | ## like printf() does, so a reasonably large number will suffice. 53 | set LeftPos 999999 54 | } 55 | 56 | ## Find cookie name 57 | if {[string index $InputStr $InputIdx] == "("} { 58 | set BeforeIdx [incr InputIdx] 59 | while {[string index $InputStr $InputIdx] != ")" && $InputIdx <= $InputLen} {incr InputIdx} 60 | set CookieName [string range $InputStr $BeforeIdx [expr {$InputIdx - 1}]] 61 | } else { 62 | ## Invalid cookie format, an open parenthesis is expected. 63 | append OutputStr [string range $InputStr $StartIdx $InputIdx] 64 | continue 65 | } 66 | 67 | if {[set CookiePos [lsearch -exact $CookieList $CookieName]] != -1} { 68 | set Value [lindex $ValueList $CookiePos] 69 | ## Type of cookie substitution to perform. 70 | if {[string is integer -strict $Value]} { 71 | append OutputStr [format "%${RightPos}i" $Value] 72 | } elseif {[regexp {^-?[0-9]+\.[0-9]+$} $Value]} { 73 | append OutputStr [format "%${RightPos}.${LeftPos}f" $Value] 74 | } else { 75 | append OutputStr [format "%${RightPos}.${LeftPos}s" $Value] 76 | } 77 | } else { 78 | ## Append the starting point of the cookie to the current index in hope that 79 | ## the user will notice that he or she has made an error in the template line. 80 | append OutputStr [string range $InputStr $StartIdx $InputIdx] 81 | } 82 | } else { 83 | append OutputStr [string index $InputStr $InputIdx] 84 | } 85 | } 86 | return $OutputStr 87 | } 88 | 89 | ## Test strings 90 | set TestCase(1) "User: %(username)/%(group) Files: %(files) Size: %(size) Speed: %.0(speed)" 91 | set TestCase(2) "User: %10.3(username)/%-10(group) Files: %02(files) Size: %(size) Speed: %9.1(speed)" 92 | set TestCase(3) "User: %5(username)/%.5(group) Files: %02(files) Size: %-7(size) Speed: %.0(speed)" 93 | set TestCase(4) "User: %3.3(username)/%4.4(group) Files: %02(files) Size: %-7(size) Speed: %.2(speed)" 94 | set TestCase(5) "Testing percent sign handling: % or 95%, double time %%!" 95 | set TestCase(6) "Invalid cookie position and precision fields: %.(speed)/%-(username)/%.-(username)/(expecting \"\")" 96 | set TestCase(7) "Error handling %(fakecookie) with %(username) and %error) %(size)" 97 | set TestCase(8) "No closing parenthesis %(username whoops, %(group)!" 98 | set TestCase(9) "We've reached the end and still no closing parenthesis! %(username" 99 | 100 | ## Cookies 101 | set ValueList "neoxed STAFF 1 200KB 12345.6789" 102 | set CookieList "username group files size speed" 103 | 104 | ## Test cases 105 | puts "Testing ParseCookies function..." 106 | set TestCases [lsort [array names TestCase]] 107 | 108 | set fp [open "CookieResults.txt" w] 109 | foreach Element $TestCases { 110 | set Data [set TestCase($Element)] 111 | puts "Test case: $Element" 112 | puts $fp "-\[Test Case #$Element\]-------------------------------------------" 113 | puts $fp "Before: $Data" 114 | puts $fp "After : [ParseCookies $Data $ValueList $CookieList]" 115 | puts $fp "1000x : [time {ParseCookies $Data $ValueList $CookieList} 1000]\n\n" 116 | flush $fp 117 | } 118 | close $fp 119 | 120 | puts "Finished." 121 | return 122 | -------------------------------------------------------------------------------- /sitebot/obsolete/incomplete-list-old.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Where glftpd is installed, and where to find the 4 | # racestats bin 5 | glroot="/glftpd" 6 | racestats="$glroot/bin/racestats" 7 | 8 | # Enter here your sections/paths. These dirs will 9 | # be searched and announced. 10 | # You can use %d, %y etc variables date cmd uses 11 | # see man date for help. You can also add / remove 12 | # path variables... 13 | path[0]="$glroot/site/incoming/games:games" 14 | path[1]="$glroot/site/incoming/apps:apps" 15 | path[2]="$glroot/site/incoming/mp3/%m%d:mp3" 16 | path[3]="$glroot/site/incoming/0day/%m%d:0day" 17 | path[3]="$glroot/site/incoming/musicvideos:musicvideos" 18 | 19 | # Verbose level. 20 | # 0 - Only announce incomplete dirs. 21 | # 1 - Announce incomplete dirs, and if the section does not 22 | # have any incomplete dirs. 23 | verbose=1 24 | 25 | # Set the format of the file/dir which marks a release 26 | # incomplete. 27 | multi_cd="[iNCoMPLETe]-[%C]-%R" 28 | single_cd="[iNCoMPLETe]-%R" 29 | 30 | # Scan today/yesterday's dir? (1 = yes, 0 = no) 31 | show_today=1 32 | show_yesterday=1 33 | 34 | # bold char. 35 | bold="\002" 36 | 37 | # 38 | #################### END OF CONFIG ############################# 39 | # 40 | 41 | function list_incompletes () { 42 | topic=$1 43 | date=$2 44 | target=$3 45 | 46 | hits=0 47 | cd $3 48 | 49 | list=`ls -1 | awk 'BEGIN { 50 | m = "'"$multi_cd"'" 51 | s = "'"$single_cd"'" 52 | p = "'"$3"'" 53 | g = "'"$glroot"'" 54 | p = substr(p, length(g) + 1) 55 | a = split(m, ta, "") 56 | m = "" 57 | for ( c = 1 ; c <= a ; c++ ) if ( ta[c] == "[" ) m = m "\\\["; 58 | else m = m ta[c] 59 | 60 | a = split(s, ta, "") 61 | s = "" 62 | for ( c = 1 ; c <= a ; c++ ) if ( ta[c] == "[" ) s = s "\\\["; 63 | else s = s ta[c] 64 | 65 | split(m, multi_1, "%C"); 66 | split(m, multi_2, "%R"); 67 | split(s, single, "%R") 68 | } { 69 | cp = length(multi_1[1]); 70 | rp = length(multi_2[1]); 71 | 72 | shown = 0 73 | 74 | if ( rp > cp ) { 75 | r1 = substr(m, 1, cp); 76 | r2 = substr(m, cp + 3, rp - cp - 2); 77 | r3 = substr(m, rp + 3); 78 | if ( match($0, r1 "..." r2 ".*" r3) ) { 79 | shown = 1 80 | c = length(substr($0, rp)) - length(r3) 81 | print p "" substr($0, rp, c) "/" substr($0, cp - 1, 3) 82 | } else if ( match($0, r1 "....." r2 ".*" r3) ) { 83 | shown = 1 84 | c = length(substr($0, rp + 2)) - length(r3) 85 | print p "" substr($0, rp + 2, c) "/" substr($0, cp - 1, 5) 86 | } 87 | } else { 88 | r1 = substr(m, 1, rp); 89 | r2 = substr(m, rp + 3, cp - rp - 2); 90 | r3 = substr(m, cp + 3); 91 | 92 | if ( match($0, r1 ".*" r2 "..." r3) ) { 93 | shown = 1 94 | c = match($0, r2 "..." r3) - rp 95 | print p "" substr($0, rp, c) "/" substr($0, cp + 1, 3) 96 | } else if ( match($0, r1 ".*" r2 "....." r3) ) { 97 | shown = 1 98 | c = match($0, r2 "....." r3) - rp 99 | print p "" substr($0, rp, c) "/" substr($0, cp + 1, 5) 100 | } 101 | } 102 | 103 | if ( shown == 0 && match($0, single[1] ".*" single[2]) ) { 104 | c = length(substr($0, length(single[1]))) - length(single[2]) 105 | print p "" substr($0, length(single[1]), c) 106 | } 107 | }'` 108 | 109 | if [ ! -z "$list" ] ; then 110 | for file in $list ; do 111 | data=`$racestats $file` 112 | if [ ! -z "$data" ] ; then 113 | echo -e "[$bold$topic$bold] $data" 114 | hits=1; 115 | fi 116 | done 117 | fi 118 | if [ $hits -eq 0 ] && [ $verbose -gt 0 ]; then 119 | echo -e "[$bold$topic$bold] No incomplete releases." 120 | fi 121 | } 122 | 123 | 124 | cnt=0 125 | while [ ! -z "${path[$cnt]}" ] ; do 126 | current_dir=`echo ${path[$cnt]} | cut -d':' -f1` 127 | title=`echo ${path[$cnt]} | cut -d':' -f2` 128 | 129 | today_dir=`date +"$current_dir"` 130 | if [ ! -z `uname -s | grep -i "linux"` ]; then 131 | yesterday_dir=`date +"$current_dir" --date "1 day ago"` 132 | else 133 | yesterday_dir=`date -v-1d +"$current_dir"` 134 | fi 135 | 136 | if [ "$yesterday_dir" != "$today_dir" ] ; then 137 | if [ $show_yesterday -eq 1 ] && [ -e $yesterday_dir ] ; then 138 | list_incompletes "$title" "yesterday" "$yesterday_dir" 139 | fi 140 | if [ "$show_today" -eq 1 ] && [ -e "$today_dir" ] ; then 141 | list_incompletes "$title" "today" "$today_dir" 142 | fi 143 | else 144 | list_incompletes "$title" "today" "$current_dir" 145 | fi 146 | 147 | cnt=$[cnt + 1] 148 | done 149 | 150 | -------------------------------------------------------------------------------- /sitebot/obsolete/ngbot.tcl: -------------------------------------------------------------------------------- 1 | ## ngbot.tcl 2 | # New zs-c bot :) 3 | # Code part only! Edit ngbot_conf.tcl for configuration :-) 4 | ## 5 | # This bot is a modularized version to replace the old and 6 | # borken dZSbot. <3 project-zs-ng! :D 7 | ## 8 | # Code: daxxar ^ project-zs-ng. 9 | ########################################################### 10 | 11 | #set glroot "/glftpd/" 12 | #set lastoct [file size "$glroot/ftp-data/glftpd.log"] 13 | set ng_displaylevels(DEBUG) 0 14 | set ng_displaylevels(INFO) 1 15 | set ng_displaylevels(WARNING) 2 16 | set ng_displaylevels(ERROR) 3 17 | set ng_displaylevels(CRITICAL) 4 18 | 19 | 20 | # Safe settings :D 21 | # Gets you the setting named $name from $section, or gets 22 | # the setting named $section if $name is unspecified or "" 23 | proc ng_get {setting {name ""}} { 24 | global conf 25 | if {$name == ""} { 26 | if {![info exists conf($setting)]} { 27 | ng_print "WARNING" "Tried to ng_get '$setting' which is an unknown variable." 28 | return 0 29 | } 30 | if {![array exists conf($setting)]} { 31 | return $conf($setting) 32 | } else { 33 | ng_print "WARNING" "Tried to ng_get '$setting' which is an array as a scalar." 34 | return 0 35 | } 36 | } 37 | if {![array exists conf($setting)]} { 38 | ng_print "WARNING" "Tried to ng_get '$setting($name)', and '$setting' isn't an array, or does not exist." 39 | return 0 40 | } elseif {![info exists conf($setting:$name)]} { 41 | ng_print "WARNING" "Tried to ng_get '$setting($name)', and '$setting($name)' does not exist." 42 | return 0 43 | } else { 44 | return $conf($setting:$name); 45 | } 46 | } 47 | 48 | # Message printing :-) 49 | # Outputs $output of level $level to console or wherever else :-) 50 | proc ng_print {level output} { 51 | global ng_displaylevels ng_mindisplaylevel 52 | if {[ng_get "ng_displaylevels" $level] < [ng_get "mindisplaylevel"]} { return } 53 | ng_triggerevent "print" {$level $output} 54 | putlog [ng_staticformat print "%bngbot[%u$level%u]:%b $message"] 55 | } 56 | 57 | # Message formatting. Formats $varmessage based on $type. :) 58 | proc ng_format {type message} { 59 | global ng_formats ng_formatvars ng_format 60 | ng_print "DEBUG" "ng_format called. TYPE: '$type' MESSAGE: '$message'" 61 | set type [string tolower $type] 62 | if {![info exists ng_formats($type)] || ![info exists ng_formatvars($type)]} { 63 | return [join $message "$ng_format(joinchar)"] 64 | } 65 | set output $ng_formats($type) 66 | set vars $ng_formatvars($type) 67 | set i 0 68 | if {[llength $message] > [llength $vars]} { set length [llength $vars] 69 | } else { set length [llength $message] } 70 | 71 | while {$i < $length} { 72 | set var [lindex $vars $i] 73 | set content [lindex $message $i] 74 | regsub -all -nocase $var $output $content output 75 | } 76 | 77 | 78 | ng_print "DEBUG" "ng_format ended. MESSAGE -> OUTPUT: '$message' -> '$output'" 79 | return $output 80 | } 81 | 82 | # Formatting of static cookies. :) 83 | proc ng_staticformat {type msg} { 84 | global ng_format 85 | set bold ng_format(bold) "\002" 86 | set uline ng_format(underline) "\037" 87 | set color ng_format(color) "\003" 88 | 89 | if {!$ng_format(print_format) && $type == "print"} { set bold ""; set uline ""; set color ""; } 90 | 91 | regsub -all -nocase "%b" $msg $bold msg 92 | regsub -all -nocase "%u" $msg $uline msg 93 | regsub -all -nocase "%c" $msg $color msg 94 | 95 | return $msg 96 | } 97 | 98 | # Binds to the event named $event, and calls $procedure 99 | # when it is triggered. 100 | # (procedure must accept two parameters, name of event 101 | # and a list of parameters. (specific to the event)) 102 | proc ng_bind {event procedure} { 103 | global ng_binds ng_events 104 | if {![info exists ng_events($event)]} { 105 | ng_print "ERROR" "Attempt at binding '$procedure' to non-existant event '$event'. Ignoring." 106 | return 107 | } 108 | 109 | set good 0 110 | if {[llength [info args $procedure]] != 2} { 111 | if {[llength [info args $procedure]] > 2} { 112 | set good 1 113 | foreach arg [lrange [info args $procedure] 1 end] { 114 | if {![info default $procedure dud]} { set good 0; break } 115 | } 116 | } 117 | if {!$good} { 118 | ng_print "ERROR" "Attempt at binding '$procedure' to '$event', but it doesn't take 2 arguments!" 119 | } 120 | } 121 | 122 | lappend ng_binds($event) $procedure 123 | incr $ng_events($event) 124 | } 125 | 126 | # Removes a bind to the event named $event that was supposed 127 | # to call $procedure. 128 | proc ng_unbind {event procedure} { 129 | global ng_binds ng_events 130 | if {![info exists ng_events($event)]} { 131 | ng_print "ERROR" "Attempt at unbinding '$procedure' from non-existant event '$event'. Ignoring." 132 | return 133 | } 134 | 135 | 136 | incr $ng_events($event) -1 137 | } 138 | 139 | # Registers event $name, for triggering later on. 140 | proc ng_registerevent {name} { 141 | global ng_binds ng_events 142 | 143 | } 144 | 145 | # Triggers the $name event, with parameters in $params 146 | proc ng_triggerevent {name params} { 147 | global ng_binds ng_events 148 | 149 | } 150 | 151 | # Loads a plugin named $name 152 | proc ng_loadplugin {name} { 153 | global plugins 154 | 155 | } 156 | 157 | ng_print "DEBUG" "Lol!" 158 | -------------------------------------------------------------------------------- /sitebot/obsolete/ngbot_conf.tcl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/glftpd/pzs-ng/92dc5509d268ba69022f4a104f70ec164fc581c1/sitebot/obsolete/ngbot_conf.tcl -------------------------------------------------------------------------------- /sitebot/obsolete/ngplugins/ng_parsefile.tcl: -------------------------------------------------------------------------------- 1 | ## ngplugins/ng_parsefile.tcl 2 | # New zs-c bot :) 3 | # Code part only! Edit ngbot_conf.tcl for configuration :-) 4 | ## 5 | # This bot is a modularized version to replace the old and 6 | # borken dZSbot. <3 project-zs-ng! :D 7 | ## 8 | # Code: daxxar ^ project-zs-ng. 9 | ########################################################### 10 | 11 | proc parselog {} { 12 | global glroot lastoct disable defaultsection variables msgtypes chanlist dZStimer use_glftpd2 13 | 14 | set dZStimer [utimer 1 "readlog"] 15 | 16 | set glftpdlogsize [file size $location(GLLOG)] 17 | 18 | if {$glftpdlogsize == $lastoct} { return 0 } 19 | if {$glftpdlogsize < $lastoct} { set lastoct 0 } 20 | if {[catch {set of [open $location(GLLOG) r]} ]} { return 0 } 21 | 22 | seek $of $lastoct 23 | while {![eof $of]} { 24 | set line [gets $of] 25 | if {$line == ""} {continue} 26 | set msgtype [string trim [lindex $line 5] ":"] 27 | set path [lindex $line 6] 28 | 29 | if {![string compare $msgtype "INVITE"]} { 30 | set nick [lindex $line 6] 31 | foreach channel $chanlist(INVITE) { puthelp "INVITE $nick $channel" } 32 | } 33 | 34 | set section [getsection $path $msgtype] 35 | if {[denycheck "$path"] == 0} { 36 | if {[string compare "$section" "$defaultsection"]} { 37 | if {$disable($msgtype) == 0 || $disable(DEFAULT) == 0} { 38 | if {[info exists variables($msgtype)]} { 39 | set echoline [parse $msgtype [lrange $line 6 end] $section] 40 | sndall $section $echoline 41 | } else { 42 | set echoline [parse DEFAULT [lrange $line 6 end] $section] 43 | sndall $section $echoline 44 | } 45 | } 46 | } else { 47 | if {[lsearch -glob $msgtypes(DEFAULT) $msgtype] != -1} { 48 | if {$disable($msgtype) == 0} { 49 | set echoline [parse $msgtype [lrange $line 6 end] "DEFAULT"] 50 | sndall "DEFAULT" $echoline 51 | } 52 | } else { 53 | if {$disable(DEFAULT) == 0} { 54 | set echoline [parse $msgtype [lrange $line 6 end] "DEFAULT"] 55 | sndall "DEFAULT" $echoline 56 | } 57 | } 58 | } 59 | } 60 | } 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | -------------------------------------------------------------------------------- /sitebot/obsolete/weektop.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | $1 -u -w | cut -c 6-18,54-62 | grep -ve "----------------------" | grep -ve "Username.*Mbyt" 4 | -------------------------------------------------------------------------------- /sitebot/plugins/AutoIRCFlag.tcl: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | # ngBot - AutoIRCFlag Gives users an IRC flag depending on their flags # 3 | ################################################################################ 4 | # 5 | # Author: Pee 6 | # mod by: Sked 7 | # 8 | # Description: 9 | # - Based on Whois.tcl by Compieter & E-Liquid 10 | # - Will give a defined IRC flag to ppl depending on their flags 11 | # 12 | # Installation: 13 | # 1. You need to have NickDb.tcl loaded. 14 | # 15 | # 2. Add the following to your eggdrop.conf: 16 | # source pzs-ng/plugins/AutoIRCFlag.tcl 17 | # 18 | # Now redundant as already present 19 | # 3. Add the following lines to your ngBot.conf: 20 | # set variables(WHOIS) "%msg" 21 | # set redirect(WHOIS) $staffchan 22 | # set disable(WHOIS) 0 23 | # 24 | # Add "WHOIS" at the end of your msgtypes(DEFAULT) line. 25 | # 26 | # Add the following line to your theme file: 27 | # announce.WHOIS = "%b{[WHOIS]} %msg" 28 | # 29 | # 4. Rehash or restart your eggdrop for the changes to take effect. 30 | # 31 | ################################################################################ 32 | 33 | namespace eval ::ngBot::plugin::AutoIRCFlag { 34 | variable ns [namespace current] 35 | variable np [namespace qualifiers [namespace parent]] 36 | variable perms 37 | 38 | ## Config Settings ############################### 39 | ## 40 | ## Permissions! Who get's which flags in chan? 41 | ## Format: IRCFLAG "SITEFLAG =GROUPNAME -USERNAME" 42 | ## with IRCFLAG the mode used on the ircd (ie o, v, h ...) 43 | ## Leave the default to op siteops (flag 1) and users with flag +A 44 | ## and give normal users (flag 3) voice 45 | array set perms { 46 | o "1 A" 47 | v "3" 48 | } 49 | ################################################## 50 | 51 | #### 52 | # AutoIRCFlag::Init 53 | # 54 | # Called on initialization; registers the event handler. Yeah, nothing fancy. 55 | # 56 | proc init {args} { 57 | if {![namespace exists [namespace parent]::NickDb]} { 58 | putlog "\[ngBot\] AutoIRCFlag Error :: Unable to find NickDb plugin." 59 | return -code -1 60 | } 61 | 62 | namespace import [namespace parent]::NickDb::* 63 | 64 | ## Bind event callbacks. 65 | bind join -|- * [namespace current]::GiveIRCFlag 66 | } 67 | 68 | #### 69 | # AutoIRCFlag::DeInit 70 | # 71 | # Called on rehash; unregisters the event handler. 72 | # 73 | proc deinit {args} { 74 | namespace delete [namespace current] 75 | } 76 | 77 | #### 78 | # AutoIRCFlag::GetInfo 79 | # 80 | # gets $group and $flags from the userfile 81 | # 82 | proc GetInfo {ftpUser groupVar flagsVar} { 83 | variable np 84 | variable ${np}::location 85 | upvar $groupVar group $flagsVar flags 86 | 87 | set file "$location(USERS)/$ftpUser" 88 | # Linux will give an error if you open a directory and try to read from it. 89 | if {![file isfile $file]} { 90 | putlog "\[ngBot\] AutoIRCFlag Error :: Invalid user file for \"$ftpUser\" ($file)." 91 | return 0 92 | } 93 | 94 | set group ""; set flags "" 95 | if {[catch {set handle [open $file r]} error] == 0} { 96 | set data [read $handle] 97 | close $handle 98 | foreach line [split $data "\n"] { 99 | switch -exact -- [lindex $line 0] { 100 | "FLAGS" {set flags [lindex $line 1]} 101 | "GROUP" {set group [lindex $line 1]} 102 | } 103 | } 104 | return 1 105 | } else { 106 | putlog "\[ngBot\] AutoIRCFlag Error :: Unable to open user file for \"$ftpUser\" ($error)." 107 | return 0 108 | } 109 | } 110 | 111 | #### 112 | # AutoIRCFlag::GiveIRCFlag 113 | # 114 | # Give IRC users an IRC flag depending on their site flags 115 | # 116 | proc GiveIRCFlag {nick host handle channel} { 117 | variable ns 118 | variable np 119 | variable perms 120 | 121 | set ftpUser [${ns}::GetFtpUser $nick] 122 | if {$ftpUser == ""} { return } 123 | 124 | if {[${ns}::GetInfo $ftpUser group flags]} { 125 | foreach mode [array names perms] { 126 | if {[${np}::rightscheck $perms($mode) $ftpUser $group $flags]} { 127 | pushmode $channel +$mode $nick 128 | putlog "\[ngBot\] AutoIRCFlag :: Gave +$mode to $nick ($ftpUser) in $channel" 129 | } 130 | } 131 | } 132 | } 133 | } 134 | -------------------------------------------------------------------------------- /sitebot/plugins/Blow.zpt: -------------------------------------------------------------------------------- 1 | ############################################################################## 2 | # # 3 | # Blow.zpt - Blowcrypt Pzs-ng Plug-in (Default Theme) # 4 | # # 5 | ############################################################################## 6 | 7 | announce.GETTOPIC = "%b{[topic ]} %topic" 8 | announce.SETTOPIC = "%b{[topic ]} %channel %topic" 9 | -------------------------------------------------------------------------------- /sitebot/plugins/Example.tcl: -------------------------------------------------------------------------------- 1 | ################################################################################# 2 | # ngBot - Example Plug-in # 3 | ################################################################################# 4 | # 5 | # Description: 6 | # - Example plugin. 7 | # - Shows: 8 | # * The basics of creating a plugin for ngBot. 9 | # * How to replace and silence the default output. 10 | # 11 | # Installation: 12 | # 1. Copy this file (Example.tcl) and the plugin theme (Example.zpt) into your 13 | # pzs-ng sitebots 'plugins' folder. 14 | # 15 | # 2. Edit the configuration options below. 16 | # 17 | # 3. Add the following to your eggdrop.conf: 18 | # source pzs-ng/plugins/Example.tcl 19 | # 20 | # 4. Rehash or restart your eggdrop for the changes to take effect. 21 | # 22 | ################################################################################# 23 | 24 | # All plugins should reside in the ::ngBot::plugin:: namespace! 25 | namespace eval ::ngBot::plugin::Example { 26 | # Short hand for ::ngBot::plugin::Example 27 | variable ns [namespace current] 28 | # Short hand for ::ngBot 29 | variable np [namespace qualifiers [namespace parent]] 30 | 31 | # NOTE: You CAN NOT declare variables from other namespaces directly within 32 | # a namespace eval {}. If you want to manipulate them you will need 33 | # to use set/array set/etc.. with the variables full path. 34 | # 35 | # This is CORRECT: 36 | # set ${np}::disable(NEWDIR) 0 37 | # 38 | # This is INCORRECT: 39 | # variables ${np}::disable 40 | # set disable(NEWDIR) 0 41 | # 42 | # This however does NOT apply to any procs within the namespace eval. 43 | 44 | variable events [list "NEWDIR"] 45 | 46 | variable scriptfile [info script] 47 | variable scriptname ${ns}::log_event 48 | 49 | # Callee: ::ngBot::init_plugins 50 | # Desc: Is not run until AFTER all scripts have been sourced. It is safe 51 | # to assume by this point that if sourced, all dependencies are 52 | # available (though they might not be init'd). Because of this, it 53 | # no longer matters what order scripts are sourced in the 54 | # eggdrop.conf file. 55 | # If you want to use your own custom error use return -code -1 56 | proc init {} { 57 | variable ns 58 | variable np 59 | variable events 60 | variable scriptname 61 | variable scriptfile 62 | # Only when declaring variables from other namespaces will you need 63 | # to use their full paths. 64 | variable ${np}::variables 65 | variable ${np}::precommand 66 | 67 | # Since we're more or less cloning NEWDIR, just copy its variables 68 | # verbatim. The variables are used to match the logdata list elements 69 | # in the callback proc (::ngBot::plugin::Example::log_event) to a name 70 | # so we can parse them in the themes. 71 | set variables(EXAMPLE-NEWDIR) $variables(NEWDIR) 72 | 73 | # Load a custom plugin theme. 74 | set theme_file [file normalize "[pwd]/[file rootname $scriptfile].zpt"] 75 | if {[file isfile $theme_file]} { 76 | # Call ::ngBot::loadtheme {file $theme_file} {isplugin true} 77 | ${np}::loadtheme $theme_file true 78 | } 79 | 80 | # Register the event handler. 81 | foreach event $events { 82 | # Don't need to use the ${np}:: prefix as it was declared earleir. 83 | # There are 2 types of default events: 84 | # precommand Run before an event, silences the default output 85 | # if the precommand callback returns false. 86 | # postcommand Run after an event. 87 | lappend precommand($event) $scriptname 88 | } 89 | } 90 | 91 | # Callee: ::ngBot::deinit 92 | # Desc: Called when the bot is cleaning up. No longer requires a bind 93 | # evnt prerehash for each plugin. This proc is also NOT REQUIRED 94 | # if all you need to do is: namespace delete [namespace current] 95 | # or unbind something that is bound to a proc within a child 96 | # namespace of ::ngBot. The callee will delete this namespace if 97 | # when the proc returns the namespace still exists and also 98 | # unbinds everything bound to a proc matching ::ngBot::*. 99 | proc deinit {} { 100 | variable ns 101 | variable np 102 | variable events 103 | variable scriptname 104 | variable ${np}::precommand 105 | 106 | # Remove the script event callback from precommand. 107 | foreach event $events { 108 | if {[info exists precommand($event)] && [set pos [lsearch -exact $precommand($event) $scriptname]] != -1} { 109 | set precommand($event) [lreplace $precommand($event) $pos $pos] 110 | } 111 | } 112 | 113 | # Remove the namespace. 114 | namespace delete $ns 115 | } 116 | 117 | # Callee: ::ngBot::readlog -> ::ngBot::eventhandler 118 | # Desc: Registered precommand callback. Will be called on NEWDIR event. 119 | proc log_event {event section logdata} { 120 | variable np 121 | 122 | # Set the event for our custom EXAMPLE-NEWDIR theme from Example.zpt. 123 | set target "EXAMPLE-NEWDIR" 124 | 125 | # Send to all the channels the NEWDIR event is set to announce 126 | # to and format the output using the EXAMPLE-NEWDIR theme. 127 | ${np}::sndall $event $section [${np}::ng_format $target $section $logdata] 128 | 129 | # Return false to silence the default output. 130 | return false 131 | } 132 | } -------------------------------------------------------------------------------- /sitebot/plugins/Example.zpt: -------------------------------------------------------------------------------- 1 | ############################################################################## 2 | # # 3 | # TVRage.zpt - Example Pzs-ng Plug-in (Default Theme) # 4 | # # 5 | ############################################################################## 6 | 7 | announce.EXAMPLE-NEWDIR = "%b{[EXAMPLE]}[%b{new }][%section] %b{%relname} by %b{%u_name} of %g_name." 8 | -------------------------------------------------------------------------------- /sitebot/plugins/GameFAQs.zpt: -------------------------------------------------------------------------------- 1 | ############################################################################## 2 | # # 3 | # GameFAQs.zpt - GameFAQs: Game Info Pzs-ng Plug-in (Default Theme) # 4 | # # 5 | ############################################################################## 6 | 7 | announce.GAMEFAQS = "[%b{game-info}][%section] %b{%gamefaqs_title} %gamefaqs_rating_users/5 URL: %gamefaqs_url\n[%b{game-info}][%section] Release Date: %loop1" 8 | announce.GAMEFAQS_LOOP1 = "%gamefaqs_region: %gamefaqs_region_date%splitter" 9 | 10 | announce.GAMEFAQS-PRE = "[%b{game-info}][%section] %b{%gamefaqs_title} %gamefaqs_rating_users/5 URL: %gamefaqs_url\n[%b{game-info}][%section] Release Date: %loop1" 11 | announce.GAMEFAQS-PRE_LOOP1 = "%gamefaqs_region: %gamefaqs_region_date%splitter" 12 | 13 | announce.GAMEFAQS-MSG = "[%b{game-info}] %b{%gamefaqs_title} %gamefaqs_rating_users/5 (%gamefaqs_rating_uservotes votes - internet: %gamefaqs_rating_internet/100) URL: %gamefaqs_url\n[%b{game-info}] %gamefaqs_description\n[%b{game-info}] Genre: %gamefaqs_genre, Players: %gamefaqs_players, System: %gamefaqs_system\n[%b{game-info}] Developer: %gamefaqs_developer, ESRB: %gamefaqs_esrb, Descriptor(s): %gamefaqs_esrb_descriptor%loop1" 14 | announce.GAMEFAQS-MSG_LOOP1 = "\n[%b{game-info}] Release Data: %gamefaqs_region: %gamefaqs_region_date (%gamefaqs_region_title by %gamefaqs_region_publisher rated %gamefaqs_region_rating)" 15 | -------------------------------------------------------------------------------- /sitebot/plugins/PreTime.zpt: -------------------------------------------------------------------------------- 1 | ############################################################################## 2 | # # 3 | # PreTime.zpt - Pre Time Plug-in (Default Theme) # 4 | # # 5 | ############################################################################## 6 | 7 | announce.NEWPRETIME = "[%b{NEW}][%section] %b{%relname} by %b{%u_name} of %g_name :: released %preage ago :: %predate %pretime." 8 | announce.OLDPRETIME = "[%b{OLD}][%section] %b{%relname} by %b{%u_name} of %g_name :: released %preage ago :: %predate %pretime." -------------------------------------------------------------------------------- /sitebot/plugins/README: -------------------------------------------------------------------------------- 1 | ############################################################### 2 | # dZSbot Plug-ins # 3 | ############################################################### 4 | 5 | # Usage 6 | ############################################################### 7 | 8 | - The plug-ins can be used by sourcing them in your eggdrop.conf; 9 | and make they are loaded AFTER dZSbot.tcl. 10 | 11 | Example: 12 | source pzs-ng/dZSbot.tcl 13 | source pzs-ng/plugins/Example.tcl 14 | 15 | # Notes 16 | ############################################################### 17 | 18 | - A pre-command and post-command script interface was added to 19 | dZSbot in revision 1428. 20 | 21 | - This interface allows end-users with Tcl knowledge to add custom 22 | features without having to directly edit the dZSbot.tcl file. 23 | 24 | - The plug-ins included can be used as an example on how to use 25 | this functionality. 26 | 27 | - ALL scripts must return a boolean value (0/FALSE or 1/TRUE). 28 | 29 | - If a pre-command script returns 0/FALSE, the remaining portion 30 | of that event will be cancelled (i.e. skipping the channel output 31 | for announcements). 32 | 33 | # Announce Events 34 | ############################################################### 35 | 36 | - Announce events are when a new log entry is read from glftpd.log, 37 | login.log, or sysop.log. 38 | 39 | - Arguments passed to the script: event section logData. 40 | 41 | 42 | # Special Events 43 | ############################################################### 44 | 45 | - INVITEUSER 46 | Trigged: On !invite and and SITE INIVITE. 47 | Args: event ircUser ftpUser ftpGroup ftpFlags 48 | 49 | - More to come... 50 | 51 | 52 | # Plug-ins 53 | ############################################################### 54 | 55 | NickDb.tcl - Keeps track of IRC nick names and their FTP user names. 56 | 57 | DeluserBan.tcl - Automatically kick and ban users from your channel 58 | on DELUSER or PURGE (requires NickDb). 59 | 60 | PreTime.tcl - Announces the pre time of a release on NEWDIR. 61 | 62 | GameFAQs.tcl - Announces game info from GamqFAQs.com on NEWDIR and PRE. 63 | 64 | TVRage.tcl - Announces TV episode info from TVRage.com on NEWDIR and PRE. 65 | -------------------------------------------------------------------------------- /sitebot/plugins/TVMaze.zpt: -------------------------------------------------------------------------------- 1 | ############################################################################## 2 | # # 3 | # TVMaze.zpt - TVMaze: TV Show & Episode Pzs-ng Plug-in (Default Theme) # 4 | # # 5 | ############################################################################## 6 | 7 | announce.TVMAZE = "[%b{tv-info}][%section] %b{%tvmaze_show_name}: %b{%tvmaze_episode_title} (%tvmaze_show_genres) %tvmaze_show_type Aired: %tvmaze_episode_original_airdate\n[%b{tv-info}][%section] URL: %tvmaze_episode_url" 8 | announce.TVMAZE-PRE = "[%b{tv-info}][%section] %b{%tvmaze_show_name}: %b{%tvmaze_episode_title} (%tvmaze_show_genres) %tvmaze_show_type Aired: %tvmaze_episode_original_airdate\n[%b{tv-info}][%section] URL: %tvmaze_episode_url" 9 | announce.TVMAZE-MSGFULL = "[%b{tv-info}] %b{%tvmaze_show_name}: %b{%tvmaze_episode_title} (%tvmaze_show_genres) Aired: %tvmaze_episode_original_airdate\n[%b{tv-info}] URL: %tvmaze_episode_url" 10 | announce.TVMAZE-MSGSHOW = "[%b{tv-info}] %b{%tvmaze_show_name} (%tvmaze_show_genres) %tvmaze_show_type\n[%b{tv-info}] Last Episode: %b{%tvmaze_show_latest_episode: %tvmaze_show_latest_title} (%tvmaze_show_latest_airdate)\n[%b{tv-info}] Next Episode: %b{%tvmaze_show_next_episode: %tvmaze_show_next_title} (%tvmaze_show_next_airdate)\n[%b{tv-info}] URL: %tvmaze_show_url" 11 | -------------------------------------------------------------------------------- /sitebot/plugins/TVRage.zpt: -------------------------------------------------------------------------------- 1 | ############################################################################## 2 | # # 3 | # TVRage.zpt - TVRage: TV Show & Episode Pzs-ng Plug-in (Default Theme) # 4 | # # 5 | ############################################################################## 6 | 7 | announce.TVRAGE = "[%b{tv-info}][%section] %b{%tvrage_show_name}: %b{%tvrage_episode_title} (%tvrage_show_genres) Aired: %tvrage_episode_original_airdate\n[%b{tv-info}][%section] URL: %tvrage_episode_url" 8 | announce.TVRAGE-PRE = "[%b{tv-info}][%section] %b{%tvrage_show_name}: %b{%tvrage_episode_title} (%tvrage_show_genres) Aired: %tvrage_episode_original_airdate\n[%b{tv-info}][%section] URL: %tvrage_episode_url" 9 | announce.TVRAGE-MSGFULL = "[%b{tv-info}] %b{%tvrage_show_name}: %b{%tvrage_episode_title} (%tvrage_show_genres) Aired: %tvrage_episode_original_airdate\n[%b{tv-info}] URL: %tvrage_episode_url" 10 | announce.TVRAGE-MSGSHOW = "[%b{tv-info}] %b{%tvrage_show_name} (%tvrage_show_genres)\n[%b{tv-info}] Last Episode: %b{%tvrage_show_latest_episode: %tvrage_show_latest_title} (%tvrage_show_latest_airdate)\n[%b{tv-info}] Next Episode: %b{%tvrage_show_next_episode: %tvrage_show_next_title} (%tvrage_show_next_airdate)\n[%b{tv-info}] URL: %tvrage_show_url" -------------------------------------------------------------------------------- /sitebot/plugins/Top.tcl: -------------------------------------------------------------------------------- 1 | ################################################################################# 2 | # ngBot - Auto Announce Top Uploaders # 3 | ################################################################################# 4 | # 5 | # Description: 6 | # - Auto announces the top uploaders at a configurable interval. 7 | # 8 | # Installation: 9 | # 1. Add the following to your eggdrop.conf: 10 | # source pzs-ng/plugins/Top.tcl 11 | # 12 | # 2. Rehash or restart your eggdrop for the changes to take effect. 13 | # 14 | # Changelog: 15 | # - 20110913 - Sked: Fixed output for users with chars other than A-Za-z0-9_ - Fix by PCFiL 16 | # 17 | ################################################################################# 18 | 19 | namespace eval ::ngBot::plugin::Top { 20 | variable ns [namespace current] 21 | variable np [namespace qualifiers [namespace parent]] 22 | 23 | variable top 24 | 25 | ## Config Settings ############################### 26 | ## 27 | ## Interval between announces in seconds (default: 7200 - 2 hours) 28 | set top(interval) 7200 29 | ## 30 | ## Section to display (0 = DEFAULT) 31 | set top(sect) 0 32 | ## 33 | ## Maximum number of users to display 34 | set top(users) 10 35 | ## 36 | ## Message prefix 37 | set top(prefix) "Week Top (Up) " 38 | ## 39 | ## Output channels 40 | set top(chan) "#pzs-ng" 41 | ## 42 | ################################################## 43 | 44 | set top(version) "20110913" 45 | 46 | variable timer 47 | 48 | 49 | proc init {args} { 50 | variable top 51 | [namespace current]::startTimer 52 | putlog "\[ngBot\] Top :: Loaded successfully (Version: $top(version))." 53 | } 54 | 55 | proc deinit {args} { 56 | [namespace current]::killTimer 57 | 58 | namespace delete [namespace current] 59 | } 60 | 61 | proc killTimer {} { 62 | variable timer 63 | 64 | if {[catch {killutimer $timer} error] != 0} { 65 | putlog "\[ngBot\] Top :: Warning: Unable to kill announce timer \"$error\"" 66 | } 67 | } 68 | 69 | proc startTimer {} { 70 | variable top 71 | 72 | variable timer [utimer $top(interval) "[namespace current]::showTop"] 73 | } 74 | 75 | proc showTop {args} { 76 | variable np 77 | variable top 78 | variable ${np}::binary 79 | variable ${np}::location 80 | 81 | [namespace current]::startTimer 82 | 83 | if {[catch {exec $binary(STATS) -r $location(GLCONF) -u -w -x $top(users) -s $top(sect)} output] != 0} { 84 | putlog "\[ngBot\] Top :: Error: Problem executing stats-exec \"$output\"" 85 | return 86 | } 87 | 88 | set msg [list] 89 | foreach line [split $output "\n"] { 90 | regsub -all -- {(\s+)\s} $line " " line 91 | 92 | if {[regexp -- {^\[(\d+)\] (.*?) (.*?) (\d+) (\d+)\w+ (\S+)} $line -> pos username tagline files bytes speed]} { 93 | lappend msg "\[$pos. $username \002$bytes\002M\]" 94 | } 95 | } 96 | 97 | if {[llength $msg] == 0} { 98 | set msg "Empty..." 99 | } 100 | 101 | foreach chan [split $top(chan)] { 102 | puthelp "PRIVMSG $chan :$top(prefix)[join $msg " "]" 103 | } 104 | } 105 | } 106 | -------------------------------------------------------------------------------- /sitebot/plugins/fishwrap.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | ################################################################################# 4 | # 20201123: wrapper for weechat fish.py 5 | ################################################################################# 6 | # See original fish.py for Copyrights, license and info: 7 | # https://github.com/weechat/scripts/blob/master/python/fish.py 8 | # Does not call pack/unpack defs but re-uses relevant dh code directly: 9 | # - vars: p_dh1080, q_dh1080 10 | # - class: DH1080Ctx 11 | # - defs: bytes2int, int2bytes dh_validate_public, dh1080_b64encode 12 | ################################################################################# 13 | 14 | import sys 15 | # dont load weechat module 16 | sys.modules["weechat"] = "" 17 | import fish as wcf 18 | 19 | # output : my public and private key 20 | if ((len(sys.argv) > 1) and (sys.argv[1] == "DH1080gen")): 21 | fish_DH1080ctx = {} 22 | targetl = "irc_nick" 23 | fish_DH1080ctx[targetl] = wcf.DH1080Ctx() 24 | try: 25 | if not 1 < fish_DH1080ctx[targetl].public < wcf.p_dh1080: 26 | sys.exit(1) 27 | if not wcf.dh_validate_public(fish_DH1080ctx[targetl].public, wcf.q_dh1080, wcf.p_dh1080): 28 | pass 29 | b64_private=wcf.dh1080_b64encode(wcf.int2bytes(fish_DH1080ctx[targetl].private)) 30 | b64_public=wcf.dh1080_b64encode(wcf.int2bytes(fish_DH1080ctx[targetl].public)) 31 | print(b64_private, b64_public) 32 | del fish_DH1080ctx[targetl] 33 | del b64_private 34 | except: 35 | sys.exit(1) 36 | 37 | # input : argv2 = my private key argv3 = someones public key 38 | # output : shared secret 39 | if ((len(sys.argv) > 3) and (sys.argv[1] == "DH1080comp")): 40 | try: 41 | private = wcf.bytes2int(wcf.dh1080_b64decode(sys.argv[2])) 42 | public = wcf.bytes2int(wcf.dh1080_b64decode(sys.argv[3])) 43 | if not 1 < public < wcf.p_dh1080: 44 | sys.exit(1) 45 | if not wcf.dh_validate_public(public, wcf.q_dh1080, wcf.p_dh1080): 46 | pass 47 | secret = pow(public, private, wcf.p_dh1080) 48 | del private 49 | print(wcf.dh1080_b64encode(wcf.sha256(wcf.int2bytes(secret)))) 50 | del secret 51 | except: 52 | sys.exit(1) 53 | 54 | #print('DEBUG: globals') 55 | -------------------------------------------------------------------------------- /sitebot/src/Makefile.in: -------------------------------------------------------------------------------- 1 | prefix=@INSTALLPATH@ 2 | CC=@CC@ 3 | RM=@RM@ -f 4 | 5 | CFLAGS=@CFLAGS@ @GLVERSION@ 6 | LDFLAGS=@LDFLAGS@ 7 | INSTALL=@INSTALL@ 8 | 9 | targets=@PASSCHK@ @SHOWLOG@ dl_speedtest 10 | install_targets=@PASSCHK2@ @SHOWLOG_INSTALL@ dl_speedtest-install 11 | 12 | all: $(targets) 13 | 14 | passchk: passchk.c 15 | $(CC) $(LDFLAGS) $(CFLAGS) -o passchk passchk.c @SSL_INCLUDE@ @SSL_LIBS@ @LCRYPT@ 16 | 17 | #ng-bw: ng-bw.c 18 | # $(CC) $(LDFLAGS) $(CFLAGS) -o ng-bw ng-bw.c 19 | 20 | showlog: showlog.c 21 | $(CC) $(LDFLAGS) $(CFLAGS) -I../../zipscript/conf/ -I../../zipscript/include/ -o showlog showlog.c 22 | 23 | dl_speedtest: dl_speedtest.c 24 | $(CC) $(LDFLAGS) $(CFLAGS) -I../../zipscript/conf/ -I../../zipscript/include/ -o dl_speedtest dl_speedtest.c 25 | 26 | install: $(install_targets) 27 | 28 | #ng-bw-install: ng-bw 29 | # $(INSTALL) -m755 ng-bw $(prefix)/bin 30 | 31 | passchk-install: passchk 32 | $(INSTALL) -m755 passchk $(prefix)/bin 33 | 34 | showlog-install: showlog 35 | $(INSTALL) -m755 showlog $(prefix)/bin 36 | 37 | dl_speedtest-install: dl_speedtest 38 | $(INSTALL) -m755 dl_speedtest $(prefix)/bin 39 | 40 | distclean: clean 41 | 42 | clean: 43 | # $(RM) ng-bw passchk showlog 44 | $(RM) passchk showlog dl_speedtest 45 | 46 | strip: 47 | strip passchk showlog dl_speedtest 48 | 49 | -------------------------------------------------------------------------------- /sitebot/src/dl_speedtest.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include "zsconfig.h" 10 | #include "zsconfig.defaults.h" 11 | #include 12 | 13 | #define TRUE 1 14 | #define FALSE 0 15 | short int matchpath(char *, char *); 16 | void debug_out(char *,...); 17 | 18 | short int matchpath(char *instr, char *path) { 19 | int pos = 0, c = 0; 20 | 21 | if ( (int)strlen(instr) < 2 || (int)strlen(path) < 2 ) 22 | return 0; 23 | 24 | do { 25 | switch (*instr) { 26 | case 0: 27 | case ' ': 28 | if ((int)strlen(path) == pos - 1 && *(path + pos - 2) != '/' && *(instr - 1) == '/') 29 | c = 1; 30 | if (!strncmp(instr - pos, path, pos - c)) { 31 | if (*(instr - 1) == '/') 32 | return 1; 33 | if ((int)strlen(path) >= pos) { 34 | if (*(path + pos) == '/' || *(path + pos) == '\0') 35 | return 1; 36 | } else 37 | return 1; 38 | } 39 | c = 0; 40 | pos = 0; 41 | break; 42 | default: 43 | ++pos; 44 | break; 45 | } 46 | } while (*instr++); 47 | 48 | return 0; 49 | } 50 | 51 | void debug_out(char *fmt,...) { 52 | #if ( debug_mode == TRUE ) 53 | time_t timenow; 54 | FILE *file; 55 | va_list ap; 56 | static char debugname[] = ".debug"; 57 | #endif 58 | 59 | if (fmt == NULL) 60 | return; 61 | 62 | #if ( debug_mode == TRUE ) 63 | va_start(ap, fmt); 64 | timenow = time(NULL); 65 | 66 | if ((file = fopen(debugname, "a+"))) { 67 | fprintf(file, "%.24s - %.6d - dl_speedtest.c - ", ctime(&timenow), getpid()); 68 | vfprintf(file, fmt, ap); 69 | fclose(file); 70 | } 71 | chmod(debugname, 0666); 72 | va_end(ap); 73 | #endif 74 | return; 75 | } 76 | 77 | int 78 | main (int argc, char **argv) 79 | { 80 | char filename[NAME_MAX], wdir[PATH_MAX], user[25], group[25]; 81 | char *p = NULL; 82 | struct stat fileinfo; 83 | double mbit, mbyte, mbps, mbytesps; 84 | FILE *glfile; 85 | time_t timenow = time(NULL); 86 | long long speed; 87 | 88 | debug_out("dl_speedtest was initiated.\n"); 89 | if ((argc < 2) || (strncasecmp(argv[1], "RETR ", 5))) { 90 | debug_out("%s: Did not receive args, or args were wrong. ($1='%s')\n", argv[0], argv[1]); 91 | return 0; 92 | } 93 | p = argv[1] + 5; 94 | snprintf(filename, sizeof(filename), "%s", p); 95 | if (!getcwd(wdir, sizeof(wdir))) { 96 | debug_out("%s: Could not retrieve current path - getcwd() failed.\n", argv[0]); 97 | return 0; 98 | } 99 | if (!matchpath(speedtest_dirs, wdir)) { 100 | debug_out("%s: Current path does not match speedtest_dirs (%s not in %s).\n", argv[0], wdir, speedtest_dirs); 101 | return 0; 102 | } 103 | if (getenv("USER") && getenv("GROUP") && getenv("SPEED")) { 104 | snprintf(user, sizeof(user) - 1, "%s", getenv("USER")); 105 | if (!strlen(user)) 106 | sprintf(user, "NoUser"); 107 | snprintf(group, sizeof(group) - 1, "%s", getenv("GROUP")); 108 | if (!strlen(group)) 109 | sprintf(group, "NoGroup"); 110 | if ((speed = strtol(getenv("SPEED"), NULL, 10)) == 0) { 111 | mbps = 1 * 1024. * 8. / 1000. / 1000.; 112 | mbytesps = 1 * 1024. / 1024. / 1024.; 113 | } else { 114 | mbps = speed * 1024. * 8. / 1000. / 1000.; 115 | mbytesps = speed * 1024. / 1024. / 1024.; 116 | } 117 | if (stat(filename, &fileinfo)) { 118 | debug_out("%s: Could not stat() file %s.\n", argv[0], filename); 119 | return 0; 120 | } 121 | if (fileinfo.st_size == 0) { 122 | mbyte = (double)1 / 1024. / 1024.; 123 | mbit = (double)1 / 1000. / 1000.; 124 | } else { 125 | mbyte = (double)fileinfo.st_size / 1024. / 1024.; 126 | mbit = (double)fileinfo.st_size / 1000. / 1000.; 127 | } 128 | if (!(glfile = fopen(log, "a+"))) { 129 | debug_out("%s: Unable to fopen() %s for appending.\n", argv[0], log); 130 | return 0; 131 | } 132 | fprintf(glfile, "%.24s DLTEST: \"%s\" {%s} {%s} {%.2f} {%.2f} {%.1f} {%.1f}\n", ctime(&timenow), wdir, user, group, mbps, mbytesps, mbyte, mbit); 133 | fclose(glfile); 134 | } 135 | return 0; 136 | } 137 | -------------------------------------------------------------------------------- /sitebot/themes/liquid.zst: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/glftpd/pzs-ng/92dc5509d268ba69022f4a104f70ec164fc581c1/sitebot/themes/liquid.zst -------------------------------------------------------------------------------- /sitewho/CHANGELOG: -------------------------------------------------------------------------------- 1 | 20110918 - - Proper support for the existing 64bit glftps 2 | - Updated matchpath and strcomp 3 | xxxxxxxx - - Fucked up one small thing (caused segfault) 4 | + Completly rewritten... phew !!! Config file has changed 5 | + sitewho now shows shows actions of 6 | in bot compatible form 7 | + User now sees his own masked/hidden actions 8 | + Now it's possible to hide whole groups too 9 | -------------------------------------------------------------------------------- /sitewho/Makefile.in: -------------------------------------------------------------------------------- 1 | prefix=@INSTALLPATH@ 2 | CC=@CC@ 3 | RM=@RM@ -f 4 | MAKE=@MAKE@ 5 | INSTALL=@INSTALL@ 6 | 7 | CFLAGS=@CFLAGS@ @GLVERSION@ @ALTWHO@ 8 | 9 | all: sitewho 10 | 11 | sitewho: sitewho.c 12 | $(CC) $(CFLAGS) -o sitewho sitewho.c 13 | 14 | install: all 15 | $(INSTALL) -m755 sitewho $(prefix)/bin 16 | @(printf "\nInstalling sitewho head/foot/conf files...\n") 17 | @([ -f "$(prefix)/ftp-data/misc/who.foot" ] && echo "$(prefix)/ftp-data/misc/who.foot already exists. NOT overwriting it." || $(INSTALL) -m644 who.foot $(prefix)/ftp-data/misc) 18 | @([ -f "$(prefix)/ftp-data/misc/who.head" ] && echo "$(prefix)/ftp-data/misc/who.head already exists. NOT overwriting it." || $(INSTALL) -m644 who.head $(prefix)/ftp-data/misc) 19 | @([ -f "$(prefix)/bin/sitewho.conf" ] && echo "$(prefix)/bin/sitewho.conf already exists. NOT overwriting it." || $(INSTALL) -m644 sitewho.conf $(prefix)/bin) 20 | @(echo) 21 | 22 | distclean: clean 23 | $(RM) sitewho.conf 24 | 25 | clean: 26 | $(RM) sitewho 27 | 28 | strip: 29 | strip sitewho 30 | -------------------------------------------------------------------------------- /sitewho/obsolete/bandwidth.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | glrootpath=/glftpd 3 | FLAGS="3" 4 | export FLAGS 5 | 6 | $glrootpath/bin/sitewho | grep -e "Up:" | grep -e "Dn:" | grep -e "Total:" | awk '{ printf("%i %0.1f %i %0.1f %i %0.1f\n", $3, $5, $8, $10, $13, $15) }' 7 | -------------------------------------------------------------------------------- /sitewho/sitewho.conf.in: -------------------------------------------------------------------------------- 1 | glrootpath = @INSTALLPATH@ 2 | headerfile = /ftp-data/misc/who.head 3 | footerfile = /ftp-data/misc/who.foot 4 | maskeddirectories = /site/groups/ /site/admins/ /site/private/ 5 | hiddenusers = sitebot siteop 6 | hiddengroups = bots siteops 7 | seeallflags = 1DE 8 | maxusers = 20 9 | case_insensitive = false 10 | count_hidden = true 11 | ipc_key = 0x0000DEAD 12 | grp_path = /etc/group 13 | idle_barrier = 30 14 | speed_threshold = 1024 15 | debug = 0 16 | 17 | ################################################################################################################## 18 | # 19 | # CONFIG OPTIONS 20 | ################ 21 | # 22 | # glrootpath = /glftpd/ ... rootpath of glftpd 23 | # headerfile = /ftp-data/misc/who.head ... shown before the list of users in non-raw mode. 24 | # footerfile = /ftp-data/misc/who.foot ... shown below the list of users in non-raw mode. 25 | # maskeddirectories = ... Real actions of users in these directories are not shown 26 | # hiddenusers = ... These users are not shown in the list 27 | # hiddengroups = ... nor these groups 28 | # seeallflags = Users with these flags see everything 29 | # maxusers = 20 ... max users displayed on output 30 | # case_insensitive = ... use case insensitive comparison when checking for hidden users/groups 31 | # count_hidden = ... set to 'true' to count hidden users when displaying the total stats. 32 | # ipc_key = 0x0000DEAD ... ipc-key used in glftpd 33 | # grp_path = /etc/group ... (chroot'ed) path to glftpd's groupfile 34 | # idle_barrier = 30 ... when a user has been idle for more than this number, he is considered an idler. if less, 35 | # he is considered a browser. 36 | # speed_threshold = 1024 ... threshold (in KB/s) for changing between KB/s and MB/s in the output. 37 | # debug = 0|1 ... if set to 1 debug output is shown. Should not be used unless needed. 38 | # 39 | # Sitewho takes several args: 40 | # ./sitewho - show user 41 | # ./sitewho - show all users 42 | # ./sitewho --raw - show all users, display in raw format 43 | # ./sitewho --ss5 - show all users, display in ss5 format 44 | # ./sitewho --nbw - show total stats for all users 45 | # ./sitewho --raw - show username, display in raw format 46 | # ./sitewho --ss5 - show username, display in ss5 format 47 | ################################################################################################################# 48 | 49 | -------------------------------------------------------------------------------- /sitewho/sitewho.h: -------------------------------------------------------------------------------- 1 | #ifndef SITEWHO_H 2 | #define SITEWHO_H 3 | 4 | struct GROUP { 5 | char *name; 6 | gid_t id; 7 | }; 8 | 9 | int check_path(char *); 10 | unsigned long filesize(char *); 11 | char *get_g_name(unsigned int); 12 | int strplen(char *); 13 | short int matchpath(char *, char *); 14 | short int strcomp(char *, char *); 15 | void showusers(int, int, char *, char); 16 | short compareflags(char *, char *); 17 | void readconfig(char *); 18 | void show(char *); 19 | void showtotals(char); 20 | int buffer_groups(char *, int); 21 | 22 | #endif 23 | 24 | -------------------------------------------------------------------------------- /sitewho/structonline.h: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | /* Force structure alignment to 4 bytes (for 64bit support). */ 5 | #if ( GLVERSION != 20164 ) 6 | #pragma pack(push, 4) 7 | #endif 8 | 9 | /* 32-bit time values (for 64bit support). */ 10 | typedef int32_t time32_t; 11 | 12 | typedef struct { 13 | int32_t tv_sec; 14 | int32_t tv_usec; 15 | } timeval32_t; 16 | 17 | #if ( GLVERSION == 13232 ) 18 | #warning Compiling for glftpd 1.32 19 | struct ONLINE { 20 | char tagline[64]; /* The users tagline */ 21 | char username[24]; /* The username of the user */ 22 | char status[256]; /* The status of the user, idle, RETR, etc */ 23 | char host[256]; /* The host the user is comming from (with ident) */ 24 | char currentdir[256]; /* The users current dir (fullpath) */ 25 | int32_t groupid; /* The groupid of the users primary group */ 26 | time32_t login_time; /* The login time since the epoch (man 2 time) */ 27 | timeval32_t tstart; /* replacement for last_update. */ 28 | uint32_t bytes_xfer; /* bytes transferred so far. */ 29 | int32_t procid; /* The processor id of the process */ 30 | } __attribute__((deprecated)); 31 | #elif ( GLVERSION == 20164 ) 32 | #warning Compiling for glftpd 2.01 64bit 33 | struct ONLINE { 34 | char tagline[64]; /* The users tagline */ 35 | char username[24]; /* The username of the user */ 36 | char status[256]; /* The status of the user, idle, RETR, etc */ 37 | short int ssl_flag; /* 0 = no ssl, 1 = ssl on control, 2 = ssl on control and data */ 38 | char host[256]; /* The host the user is comming from (with ident) */ 39 | char currentdir[256]; /* The users current dir (fullpath) */ 40 | long groupid; /* The groupid of the users primary group */ 41 | time_t login_time; /* The login time since the epoch (man 2 time) */ 42 | struct timeval tstart; /* replacement for last_update. */ 43 | struct timeval txfer; /* The time of the last succesfull transfer. */ 44 | unsigned long long bytes_xfer; /* bytes transferred so far. */ 45 | unsigned long long bytes_txfer; /* bytes transferred in the last loop (speed limiting) */ 46 | pid_t procid; /* The processor id of the process */ 47 | }; 48 | #elif ( GLVERSION == 20032 ) 49 | #warning Compiling for glftpd 2.00 50 | struct ONLINE { 51 | char tagline[64]; /* The users tagline */ 52 | char username[24]; /* The username of the user */ 53 | char status[256]; /* The status of the user, idle, RETR, etc */ 54 | int16_t ssl_flag; /* 0 = no ssl, 1 = ssl on control, 2 = ssl on control and data */ 55 | char host[256]; /* The host the user is comming from (with ident) */ 56 | char currentdir[256]; /* The users current dir (fullpath) */ 57 | int32_t groupid; /* The groupid of the users primary group */ 58 | time32_t login_time; /* The login time since the epoch (man 2 time) */ 59 | timeval32_t tstart; /* replacement for last_update. */ 60 | timeval32_t txfer; /* The time of the last succesfull transfer. */ 61 | uint64_t bytes_xfer; /* bytes transferred so far. */ 62 | int32_t procid; /* The processor id of the process */ 63 | }; 64 | #else 65 | /* 20132 & 20232 & 20264 */ 66 | struct ONLINE { 67 | char tagline[64]; /* The users tagline */ 68 | char username[24]; /* The username of the user */ 69 | char status[256]; /* The status of the user, idle, RETR, etc */ 70 | int16_t ssl_flag; /* 0 = no ssl, 1 = ssl on control, 2 = ssl on control and data */ 71 | char host[256]; /* The host the user is comming from (with ident) */ 72 | char currentdir[256]; /* The users current dir (fullpath) */ 73 | int32_t groupid; /* The groupid of the users primary group */ 74 | time32_t login_time; /* The login time since the epoch (man 2 time) */ 75 | timeval32_t tstart; /* replacement for last_update. */ 76 | timeval32_t txfer; /* The time of the last succesfull transfer. */ 77 | uint64_t bytes_xfer; /* bytes transferred so far. */ 78 | uint64_t bytes_txfer; /* bytes transferred in the last loop (speed limiting) */ 79 | int32_t procid; /* The processor id of the process */ 80 | }; 81 | #endif 82 | 83 | /* Restore default structure alignment for non-critical structures. */ 84 | #if ( GLVERSION != 20164 ) 85 | #pragma pack(pop) 86 | #endif 87 | -------------------------------------------------------------------------------- /sitewho/who.foot: -------------------------------------------------------------------------------- 1 | `-----------------------------------------------------------------------' 2 | -------------------------------------------------------------------------------- /sitewho/who.head: -------------------------------------------------------------------------------- 1 | .-[PZS-NG]--------------------------------------------------------------. 2 | -------------------------------------------------------------------------------- /version.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # extract abbreviated hash from head 3 | GIT_PREFIX="git-" 4 | GIT_HASH="${GIT_PREFIX}dl" 5 | if [ -f .git/HEAD ]; then 6 | if [ "$(cut -c1-5 .git/HEAD)" = "ref: " ]; then 7 | GIT_REF=".git/$(cut -c6- .git/HEAD)" 8 | if [ -f ${GIT_REF} ]; then 9 | GIT_HASH="${GIT_PREFIX}$(basename ${GIT_REF})-$(cut -c1-8 ${GIT_REF})" 10 | fi 11 | else 12 | GIT_HASH="$GIT_PREFIX$(cut -c1-8 .git/HEAD)" 13 | fi 14 | fi 15 | echo ${GIT_HASH} 16 | 17 | cat << EOF > zipscript/include/ng-version.h 18 | #ifndef _NG_VERSION_H_ 19 | #define _NG_VERSION_H_ 20 | 21 | #define NG_VERSION "${GIT_HASH}" 22 | 23 | #endif 24 | EOF 25 | -------------------------------------------------------------------------------- /zipscript/conf/zsconfig.h.all.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # small script to create a "full" zsconfig. 4 | 5 | if [ -e zipscript/include/zsconfig.defaults.h ]; then 6 | cat zipscript/include/zsconfig.defaults.h | grep -e "^#define" -a -e "^ " -a -e "^/" -a -e "^ " >zipscript/conf/zsconfig.h.all 7 | echo "zipscript/conf/zsconfig.h.all created." 8 | elif [ -e ../include/zsconfig.defaults.h ]; then 9 | cat ../include/zsconfig.defaults.h | grep -e "^#define" -a -e "^ " -a -e "^/" -a -e "^ " >zsconfig.h.all 10 | echo "zsconfig.h.all created." 11 | else 12 | echo "FAIL: could not find zsconfig.defaults.h." 13 | fi 14 | exit 0 15 | 16 | -------------------------------------------------------------------------------- /zipscript/conf/zsconfig.h.complete: -------------------------------------------------------------------------------- 1 | No. You won't find all settings here. See README.ZSCONFIG. 2 | 3 | -------------------------------------------------------------------------------- /zipscript/conf/zsconfig.h.dist: -------------------------------------------------------------------------------- 1 | /* zsconfig.h - ZipScript-C config file 2 | * 3 | * This file only contains overrides of the defaults. If you need to edit/change 4 | * other options, please copy the option from README.ZSCONFIG and place it in 5 | * here. 6 | * The complete list of options availible is found in README.ZSCONFIG. 7 | * 8 | * Please do not change settings you do not understand! 9 | * 10 | * The hash char ``#'' does not signify comments! DO NOT REMOVE! 11 | */ 12 | 13 | 14 | /* DO NOT USE WILDCARDS HERE! */ 15 | #define sitepath_dir "/site/" 16 | #define group_dirs "/site/groups/" 17 | #define zip_dirs "/site/test/ /site/incoming/0day/" 18 | #define sfv_dirs "/site/test/ /site/incoming/mp3/ /site/incoming/games/ /site/incoming/apps/ /site/incoming/musicvideos/ /site/incoming/requests/" 19 | #define nocheck_dirs "/site/private/" 20 | #define noforce_sfv_first_dirs "/site/incoming/requests/" 21 | #define audio_nocheck_dirs "/site/groups/ /site/incoming/requests/" 22 | #define allowed_types_exemption_dirs "/site/incoming/musicvideos/" 23 | #define check_for_missing_nfo_dirs "/site/incoming/games/ /site/incoming/apps/" 24 | #define cleanupdirs "/site/test/ /site/incoming/games/ /site/incoming/apps/ /site/incoming/musicvideos/" 25 | #define cleanupdirs_dated "/site/incoming/0day/%m%d/ /site/incoming/mp3/%m%d/" 26 | 27 | #define check_for_missing_sample_dirs "/site/incoming/movies/" 28 | #define create_missing_sample_link FALSE 29 | 30 | #define short_sitename "NG" 31 | 32 | #define debug_mode FALSE 33 | #define debug_altlog TRUE 34 | 35 | #define status_bar_type BAR_DIR 36 | #define incompleteislink TRUE 37 | 38 | #define ignored_types ",diz,debug,message,imdb,html,url,m3u,metadata" 39 | 40 | #define deny_double_sfv FALSE 41 | #define force_sfv_first FALSE 42 | 43 | #define audio_genre_path "/site/incoming/music.by.genre/" 44 | #define audio_artist_path "/site/incoming/music.by.artist/" 45 | #define audio_year_path "/site/incoming/music.by.year/" 46 | #define audio_group_path "/site/incoming/music.by.group/" 47 | #define audio_language_path "/site/incoming/music.by.language/" 48 | #define allowed_constant_bitrates "160,192" 49 | #define allowed_years "2007,2008,2009,2010,2011,2012" 50 | #define banned_genres "Christian Rap,Christian Gangsta Rap,Contemporary Christian,Christian Rock" 51 | #define allowed_genres "Top 40,Pop Funk,Rock,Pop" 52 | #define audio_genre_sort FALSE 53 | #define audio_year_sort FALSE 54 | #define audio_artist_sort FALSE 55 | #define audio_group_sort FALSE 56 | #define audio_language_sort FALSE 57 | #define audio_cbr_check TRUE 58 | #define audio_cbr_warn TRUE 59 | #define audio_year_check TRUE 60 | #define audio_year_warn TRUE 61 | #define audio_banned_genre_check TRUE 62 | #define audio_allowed_genre_check FALSE 63 | #define audio_genre_warn TRUE 64 | 65 | #define enable_nfo_script FALSE 66 | #define nfo_script "/bin/psxc-imdb.sh" 67 | #define enable_complete_script FALSE 68 | #define complete_script "/bin/nfo_copy.sh" 69 | -------------------------------------------------------------------------------- /zipscript/conf/zsconfig.h.dist-nonglftpd: -------------------------------------------------------------------------------- 1 | /* zsconfig.h - ZipScript-C config file 2 | * 3 | * This file only contains overrides of the defaults. If you need to edit/change 4 | * other options, please copy the option from README.ZSCONFIG and place it in 5 | * here. 6 | * The complete list of options availible is found in README.ZSCONFIG. 7 | * 8 | * Please do not change settings you do not understand! 9 | * 10 | * The hash char ``#'' does not signify comments! DO NOT REMOVE! 11 | */ 12 | 13 | 14 | /* DO NOT USE WILDCARDS HERE! */ 15 | #define sitepath_dir "/site/" 16 | #define group_dirs "/site/groups/" 17 | #define zip_dirs "/site/test/ /site/incoming/0day/" 18 | #define sfv_dirs "/site/test/ /site/incoming/mp3/ /site/incoming/games/ /site/incoming/apps/ /site/incoming/musicvideos/ /site/incoming/requests/" 19 | #define nocheck_dirs "/site/private/" 20 | #define noforce_sfv_first_dirs "/site/incoming/requests/" 21 | #define audio_nocheck_dirs "/site/groups/ /site/incoming/requests/" 22 | #define allowed_types_exemption_dirs "/site/incoming/musicvideos/" 23 | #define check_for_missing_nfo_dirs "/site/incoming/games/ /site/incoming/apps/" 24 | #define cleanupdirs "/site/test/ /site/incoming/games/ /site/incoming/apps/ /site/incoming/musicvideos/" 25 | #define cleanupdirs_dated "/site/incoming/0day/%m%d/ /site/incoming/mp3/%m%d/" 26 | 27 | #define short_sitename "NG" 28 | 29 | #define debug_mode FALSE 30 | #define debug_altlog TRUE 31 | 32 | #define status_bar_type BAR_DIR 33 | #define incompleteislink TRUE 34 | 35 | #define ignored_types ",diz,debug,message,imdb,html,url,m3u,metadata" 36 | 37 | #define deny_double_sfv FALSE 38 | #define force_sfv_first FALSE 39 | 40 | #define audio_genre_path "/site/incoming/music.by.genre/" 41 | #define audio_artist_path "/site/incoming/music.by.artist/" 42 | #define audio_year_path "/site/incoming/music.by.year/" 43 | #define audio_group_path "/site/incoming/music.by.group/" 44 | #define audio_language_path "/site/incoming/music.by.language/" 45 | #define allowed_constant_bitrates "160,192" 46 | #define allowed_years "2007,2008,2009,2010,2011,2012" 47 | #define banned_genres "Christian Rap,Christian Gangsta Rap,Contemporary Christian,Christian Rock" 48 | #define allowed_genres "Top 40,Pop Funk,Rock,Pop" 49 | #define audio_genre_sort FALSE 50 | #define audio_year_sort FALSE 51 | #define audio_artist_sort FALSE 52 | #define audio_group_sort FALSE 53 | #define audio_language_sort FALSE 54 | #define audio_cbr_check TRUE 55 | #define audio_cbr_warn TRUE 56 | #define audio_year_check TRUE 57 | #define audio_year_warn TRUE 58 | #define audio_banned_genre_check TRUE 59 | #define audio_allowed_genre_check FALSE 60 | #define audio_genre_warn TRUE 61 | 62 | #define enable_nfo_script FALSE 63 | #define nfo_script "/bin/psxc-imdb.sh" 64 | #define enable_complete_script FALSE 65 | #define complete_script "/bin/nfo_copy.sh" 66 | 67 | /* These are settings that are especially relevant when you're not running under glftpd. 68 | * Make sure that all paths are absolute and _real_, e.g. set log to /home/myuser/wzd/var/log/wzdftpd/wzd.log 69 | * 70 | * You should probably also create these two first dirs using: 71 | * mkdir -p -m777 /home/myuser/wzd/var/lib/pzs-ng */ 72 | 73 | #define log "/ftp-data/logs/glftpd.log" 74 | #define storage "/ftp-data/pzs-ng/" 75 | #define banned_filelist "/ftp-data/misc/banned_filelist.txt" 76 | 77 | #define zip_bin "/bin/zip" 78 | #define unzip_bin "/bin/unzip" 79 | -------------------------------------------------------------------------------- /zipscript/conf/zsconfig.h.ss5.dist: -------------------------------------------------------------------------------- 1 | /* zsconfig.h - ZipScript-C config file 2 | * 3 | * This file only contains overrides of the defaults. 4 | * Please see README.ZSCONFIG for a complete list 5 | * of all settings. 6 | * 7 | * Please do not change settings you do not understand! 8 | * 9 | */ 10 | 11 | 12 | 13 | /* DO NOT USE WILDCARDS HERE - only cleanupdirs use wildcards! */ 14 | #define sitepath_dir "/site/" 15 | #define group_dirs "/site/groups/" 16 | #define zip_dirs "/site/incoming/0day/" 17 | #define sfv_dirs "/site/test/ /site/incoming/mp3/ /site/incoming/games/ /site/incoming/apps/ /site/incoming/musicvideos/ /site/incoming/requests/" 18 | #define nocheck_dirs "/site/private/" 19 | #define noforce_sfv_first_dirs "/site/incoming/requests/" 20 | #define audio_nocheck_dirs "/site/groups/ /site/incoming/requests/" 21 | #define allowed_types_exemption_dirs "/site/incoming/musicvideos/" 22 | #define check_for_missing_nfo_dirs "/site/incoming/games/ /site/incoming/apps/" 23 | 24 | #define cleanupdirs "/site/test/ /site/incoming/games/ /site/incoming/apps/ /site/incoming/musicvideos/ /site/incoming/0day/%m%d/ /site/incoming/mp3/%m%d/" 25 | 26 | #define short_sitename "NG" 27 | 28 | #define status_bar_type 1 29 | 30 | #define incompleteislink 1 31 | 32 | #define ignored_types ",diz,debug,message,imdb" 33 | 34 | #define debug_mode TRUE 35 | #define remove_dot_files_on_delete FALSE 36 | #define remove_dot_debug_on_delete TRUE 37 | 38 | #define deny_double_sfv FALSE 39 | #define force_sfv_first FALSE 40 | 41 | #define audio_genre_path "/site/incoming/music.by.genre/" 42 | #define audio_artist_path "/site/incoming/music.by.artist/" 43 | #define audio_year_path "/site/incoming/music.by.year/" 44 | #define audio_group_path "/site/incoming/music.by.group/" 45 | #define allowed_constant_bitrates "160,192" 46 | #define allowed_years "2007,2008,2009,2010,2011,2012" 47 | #define banned_genres "Christian Rap" 48 | #define allowed_genres "Rock" 49 | #define audio_genre_sort FALSE 50 | #define audio_year_sort FALSE 51 | #define audio_artist_sort FALSE 52 | #define audio_group_sort FALSE 53 | #define audio_cbr_check TRUE 54 | #define audio_cbr_warn TRUE 55 | #define audio_year_check TRUE 56 | #define audio_year_warn TRUE 57 | #define audio_banned_genre_check TRUE 58 | #define audio_allowed_genre_check FALSE 59 | #define audio_genre_warn TRUE 60 | 61 | #define announce_norace TRUE 62 | 63 | #define enable_nfo_script TRUE 64 | #define nfo_script "/bin/tclsh /bin/movie3.tcl" 65 | #define enable_complete_script FALSE 66 | #define complete_script "/bin/nfo_copy.sh" 67 | 68 | #define max_users_in_top 12 69 | #define max_groups_in_top 6 70 | 71 | -------------------------------------------------------------------------------- /zipscript/include/abs2rel.h: -------------------------------------------------------------------------------- 1 | #ifndef ABS2REL_H 2 | #define ABS2REL_H 3 | 4 | extern char *abs2rel(const char *, const char *, char *, const size_t); 5 | 6 | #endif 7 | -------------------------------------------------------------------------------- /zipscript/include/audio.h: -------------------------------------------------------------------------------- 1 | /* 2 | * (C) Copyright 2004 Wojtek Kaniewski 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License Version 2 as 6 | * published by the Free Software Foundation. 7 | * 8 | * This program is distributed in the hope that it will be useful, 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | * GNU General Public License for more details. 12 | * 13 | * You should have received a copy of the GNU General Public License 14 | * along with this program; if not, write to the Free Software 15 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 16 | */ 17 | 18 | #ifndef __AUDIO_H 19 | #define __AUDIO_H 20 | 21 | struct audio_format { 22 | WORD tag; 23 | const char *descr; 24 | } audio_formats[] = { 25 | { 0x1, "PCM" }, 26 | { 0x2, "MS ADPCM" }, 27 | { 0x6, "aLaw PCM" }, 28 | { 0x6, "uLaw PCM" }, 29 | { 0x11, "IMA ADPCM" }, 30 | { 0x31, "MS GSM" }, 31 | { 0x32, "MSN AUDIO" }, 32 | { 0x50, "MPEG Layer 1/2 Audio" }, 33 | { 0x55, "MPEG Layer 3 Audio" }, 34 | { 0x160, "Windows Media Audio" }, 35 | { 0x161, "Windows Media Audio" }, 36 | { 0x162, "Windows Media Audio" }, 37 | { 0x163, "Windows Media Audio" }, 38 | { 0x2000, "AC3" }, 39 | { 0, NULL }, 40 | }; 41 | 42 | #endif /* __AUDIO_H */ 43 | -------------------------------------------------------------------------------- /zipscript/include/audiosort.h: -------------------------------------------------------------------------------- 1 | #ifndef _AUDIOSORT_H_ 2 | #define _AUDIOSORT_H_ 3 | 4 | #include "objects.h" 5 | 6 | extern void audioSortDir(char *); 7 | extern void audioSort(struct audio *, char *, char *); 8 | 9 | #endif 10 | 11 | -------------------------------------------------------------------------------- /zipscript/include/avi.h: -------------------------------------------------------------------------------- 1 | /* 2 | * (C) Copyright 2004 Wojtek Kaniewski 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License Version 2 as 6 | * published by the Free Software Foundation. 7 | * 8 | * This program is distributed in the hope that it will be useful, 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | * GNU General Public License for more details. 12 | * 13 | * You should have received a copy of the GNU General Public License 14 | * along with this program; if not, write to the Free Software 15 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 16 | */ 17 | 18 | #ifndef __AVI_H 19 | #define __AVI_H 20 | 21 | #include /* needed for uint32_t */ 22 | 23 | typedef uint32_t FOURCC; /* must be 32bit */ 24 | typedef uint32_t DWORD; /* must be 32bit */ 25 | typedef unsigned short WORD; 26 | 27 | typedef struct { 28 | DWORD dwMicroSecPerFrame; 29 | DWORD dwMaxBytesPerSec; 30 | DWORD dwPaddingGranularity; 31 | DWORD dwFlags; 32 | DWORD dwTotalFrames; 33 | DWORD dwInitialFrames; 34 | DWORD dwStreams; 35 | DWORD dwSuggestedBufferSize; 36 | DWORD dwWidth; 37 | DWORD dwHeight; 38 | DWORD dwReserved[4]; 39 | } AVIMAINHEADER; 40 | 41 | typedef struct { 42 | FOURCC fccType; 43 | FOURCC fccHandler; 44 | DWORD dwFlags; 45 | WORD wPriority; 46 | WORD wLanguage; 47 | DWORD dwInitialFrames; 48 | DWORD dwScale; 49 | DWORD dwRate; 50 | DWORD dwStart; 51 | DWORD dwLength; 52 | DWORD dwSuggestedBufferSize; 53 | DWORD dwQuality; 54 | DWORD dwSampleSize; 55 | struct { 56 | short int left; 57 | short int top; 58 | short int right; 59 | short int bottom; 60 | } rcFrame; 61 | } AVISTREAMHEADER; 62 | 63 | #ifndef WIN32 64 | 65 | typedef struct { 66 | WORD wFormatTag; 67 | WORD nChannels; 68 | DWORD nSamplesPerSec; 69 | DWORD nAvgBytesPerSec; 70 | WORD nBlockAlign; 71 | WORD wBitsPerSample; 72 | WORD cbSize; 73 | } WAVEFORMATEX; 74 | 75 | typedef struct { 76 | DWORD biSize; 77 | DWORD biWidth; 78 | DWORD biHeight; 79 | WORD biPlanes; 80 | WORD biBitCount; 81 | DWORD biCompression; 82 | DWORD biSizeImage; 83 | DWORD biXPelsPerMeter; 84 | DWORD biYPelsPerMeter; 85 | DWORD biClrUsed; 86 | DWORD biClrImportant; 87 | } BITMAPINFOHEADER; 88 | 89 | #endif 90 | 91 | /* stolen from libavcodec */ 92 | 93 | #define MKTAG(a, b, c, d) (a | (b << 8) | (c << 16) | (d << 24)) 94 | 95 | #endif /* __AVI_H */ 96 | 97 | -------------------------------------------------------------------------------- /zipscript/include/cleanup.h: -------------------------------------------------------------------------------- 1 | #ifndef CLEANUP_H 2 | #define CLEANUP_H 3 | 4 | void scandirectory(char *, int); 5 | char *replace_cookies(char *); 6 | void incomplete_cleanup(char *, char *, int); 7 | void cleanup(char *, char *, int, char *); 8 | int checklink(char *, char *, int); 9 | int regcomp_error(int, regex_t *, char *); 10 | short matchpath(char *, char *); 11 | 12 | #endif 13 | -------------------------------------------------------------------------------- /zipscript/include/complete.h: -------------------------------------------------------------------------------- 1 | #ifndef _COMPLETE_H_ 2 | #define _COMPLETE_H_ 3 | 4 | /*void complete(struct LOCATIONS *, struct VARS *, struct USERINFO **, struct GROUPINFO **, int);*/ 5 | /*extern void writetop(struct VARS *, struct USERINFO **, struct GROUPINFO **, int);*/ 6 | extern void complete(GLOBAL *, int); 7 | extern void writetop(GLOBAL *, int); 8 | #endif 9 | -------------------------------------------------------------------------------- /zipscript/include/constants.h: -------------------------------------------------------------------------------- 1 | constants.dzsbot.h -------------------------------------------------------------------------------- /zipscript/include/convert.h: -------------------------------------------------------------------------------- 1 | #ifndef _CONVERT_H_ 2 | #define _CONVERT_H_ 3 | 4 | char *hms(char *, int); 5 | char *convert(struct VARS *, struct USERINFO **, struct GROUPINFO **, char *); 6 | char *convert_user(struct VARS *, struct USERINFO *, struct GROUPINFO **, char *, short); 7 | char *convert_group(struct VARS *, struct GROUPINFO *, char *, short); 8 | char *convert_audio(struct VARS *, char *); 9 | char *convert_sitename(char *); 10 | char *incomplete(char *, char [2][PATH_MAX], struct VARS *, int); 11 | 12 | #endif 13 | -------------------------------------------------------------------------------- /zipscript/include/crc.h: -------------------------------------------------------------------------------- 1 | #ifndef _CRC_H_ 2 | #define _CRC_H_ 3 | 4 | unsigned int calc_crc32(char *); 5 | 6 | #endif 7 | -------------------------------------------------------------------------------- /zipscript/include/datacleaner.h: -------------------------------------------------------------------------------- 1 | #ifndef DATACLEANER_H 2 | #define DATACLEANER_H 3 | 4 | void remove_dir_loop(char *); 5 | void check_dir_loop(char *, int); 6 | 7 | #endif 8 | 9 | -------------------------------------------------------------------------------- /zipscript/include/dizreader.h: -------------------------------------------------------------------------------- 1 | #ifndef _DIZREADER_H_ 2 | #define _DIZREADER_H_ 3 | 4 | void removespaces(char *, int); 5 | //int read_diz(char *); 6 | int read_diz(void); 7 | 8 | #endif 9 | -------------------------------------------------------------------------------- /zipscript/include/errors.h: -------------------------------------------------------------------------------- 1 | #ifndef BAD_CRC 2 | #define BAD_CRC_is_defaulted 3 | #define BAD_CRC "CRC-Check: BAD!" 4 | #endif 5 | 6 | #ifndef BAD_ZIP 7 | #define BAD_ZIP_is_defaulted 8 | #define BAD_ZIP "ZiP-Integrity: BAD!" 9 | #endif 10 | 11 | #ifndef BANNED_BITRATE 12 | #define BANNED_BITRATE_is_defaulted 13 | #define BANNED_BITRATE "%s kbit codec is not allowed here!" 14 | #endif 15 | 16 | #ifndef BANNED_FILE 17 | #define BANNED_FILE_is_defaulted 18 | #define BANNED_FILE "Banned file: Not allowed!" 19 | #endif 20 | 21 | #ifndef BANNED_GENRE 22 | #define BANNED_GENRE_is_defaulted 23 | #define BANNED_GENRE "%s is banned here!" 24 | #endif 25 | 26 | #ifndef BANNED_YEAR 27 | #define BANNED_YEAR_is_defaulted 28 | #define BANNED_YEAR "Releases from %s are not allowed here!" 29 | #endif 30 | 31 | #ifndef DOUBLE_SFV 32 | #define DOUBLE_SFV_is_defaulted 33 | #define DOUBLE_SFV "SFV-file: DUPE!" 34 | #endif 35 | 36 | #ifndef DUPE_NFO 37 | #define DUPE_NFO_is_defaulted 38 | #define DUPE_NFO "NFO-File: DUPE!" 39 | #endif 40 | 41 | #ifndef EMPTY_FILE 42 | #define EMPTY_FILE_is_defaulted 43 | #define EMPTY_FILE "0byte-file: Not allowed!" 44 | #endif 45 | 46 | #ifndef EMPTY_SFV 47 | #define EMPTY_SFV_is_defaulted 48 | #define EMPTY_SFV "SFV-file: BAD!" 49 | #endif 50 | 51 | #ifndef NOT_IN_SFV 52 | #define NOT_IN_SFV_is_defaulted 53 | #define NOT_IN_SFV "CRC-Check: Not in sfv!" 54 | #endif 55 | 56 | #ifndef SFV_FIRST 57 | #define SFV_FIRST_is_defaulted 58 | #define SFV_FIRST "CRC-Check: SFV first!" 59 | #endif 60 | 61 | #ifndef SPEEDTEST 62 | #define SPEEDTEST_is_defaulted 63 | #define SPEEDTEST "BW: %.1fMiB (%.1fMB) @ %.2fMbps (%.2fMB/s)." 64 | #endif 65 | 66 | #ifndef UNKNOWN_FILE 67 | #define UNKNOWN_FILE_is_defaulted 68 | #define UNKNOWN_FILE "%s-file: Not allowed!" 69 | #endif 70 | 71 | #ifndef ZIP_NFO 72 | #define ZIP_NFO_is_defaulted 73 | #define ZIP_NFO "NFO-File: Not allowed here!" 74 | #endif 75 | 76 | -------------------------------------------------------------------------------- /zipscript/include/helpfunctions.h: -------------------------------------------------------------------------------- 1 | #ifndef _HELPFUNCTIONS_H 2 | #define _HELPFUNCTIONS_H 3 | 4 | #include 5 | 6 | #define WHITESPACE_STR " \f\n\r\t\v" 7 | #define BAD_STR "\b\f\n\r\t\v" 8 | 9 | extern char *find_last_of(char *, const char *); 10 | extern char *find_first_of(char *, const char *); 11 | extern void tailstrip_chars(char *, char *); 12 | extern char *prestrip_chars(char *, char *); 13 | extern void strip_chars(char *, char*); 14 | extern void xlock(struct flock *, int, short); 15 | extern void xunlock(struct flock *, int); 16 | 17 | #endif 18 | 19 | -------------------------------------------------------------------------------- /zipscript/include/macros.h: -------------------------------------------------------------------------------- 1 | #ifndef _MACROS_H_ 2 | #define _MACROS_H_ 3 | 4 | #ifdef HAVE_CONFIG_H 5 | # include "config.h" 6 | #endif 7 | 8 | #if HAVE_DIRENT_H 9 | #include 10 | #define NAMLEN(dirent) strlen((dirent)->d_name) 11 | #else 12 | #define dirent direct 13 | #define NAMLEN(dirent) (dirent)->d_namlen 14 | #if HAVE_SYS_NDIR_H 15 | #include 16 | #endif 17 | #if HAVE_SYS_DIR_H 18 | #include 19 | #endif 20 | #if HAVE_NDIR_H 21 | #include 22 | #else 23 | #error "No dirent header, quitting." 24 | #endif 25 | #endif 26 | 27 | /* General */ 28 | #if ( incompleteislink == TRUE ) 29 | #if ( userellink == TRUE ) 30 | #define create_incomplete() symlink(g.v.misc.release_name, g.l.incomplete) 31 | #define create_incomplete_nfo() symlink(g.v.misc.release_name, g.l.nfo_incomplete) 32 | #define create_incomplete_sample() symlink(g.v.misc.release_name, g.l.sample_incomplete) 33 | #define create_incomplete_sfv() symlink(g.v.misc.release_name, g.l.sfv_incomplete) 34 | #else 35 | #define create_incomplete() symlink(g.l.path, g.l.incomplete) 36 | #define create_incomplete_nfo() symlink(g.l.path, g.l.nfo_incomplete) 37 | #define create_incomplete_sample() symlink(g.l.path, g.l.sample_incomplete) 38 | #define create_incomplete_sfv() symlink(g.l.path, g.l.sfv_incomplete) 39 | #endif 40 | #else 41 | #define create_incomplete() createzerofile(g.l.incomplete) 42 | #define create_incomplete_nfo() createzerofile(g.l.nfo_incomplete) 43 | #define create_incomplete_sample() createzerofile(g.l.sample_incomplete) 44 | #define create_incomplete_sfv() createzerofile(g.l.sfv_incomplete) 45 | #endif 46 | 47 | /* No race */ 48 | #if ( announce_norace == TRUE ) 49 | #define CHOOSE(a,b,c) g.v.total.users > 1 ? b : c; 50 | #else 51 | #define CHOOSE(a,b,c) b; 52 | #endif 53 | 54 | #ifndef alloca 55 | #define m_alloc(x) malloc(x) 56 | #define m_free(p) free(p) 57 | #else 58 | #define m_alloc(x) alloca(x) 59 | #define m_free(p) 60 | #endif 61 | 62 | #endif 63 | -------------------------------------------------------------------------------- /zipscript/include/mp3info.h: -------------------------------------------------------------------------------- 1 | /* 2 | * mp3tech.h - Headers for mp3tech.c 3 | * 4 | * Copyright (C) 2000-2001 Cedric Tefft 5 | * 6 | * This program is free software; you can redistribute it and/or modify it under 7 | * the terms of the GNU General Public License as published by the Free 8 | * Software Foundation; either version 2 of the License, or (at your option) 9 | * any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, but WITHOUT 12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 14 | * more details. 15 | * 16 | * You should have received a copy of the GNU General Public License along with 17 | * this program; if not, write to the Free Software Foundation, Inc., 675 18 | * Mass Ave, Cambridge, MA 02139, USA. 19 | * 20 | ************************************************************************** 21 | * 22 | * 23 | * This file is based in part on: 24 | * 25 | * MP3Info 0.5 by Ricardo Cerqueira MP3Stat 0.9 by Ed Sweetman 26 | * and Johannes Overmann 27 | * 28 | */ 29 | 30 | #include 31 | #include 32 | #include 33 | #include 34 | #include 35 | #include 36 | #include "objects.h" 37 | 38 | /* 39 | * MIN_CONSEC_GOOD_FRAMES defines how many consecutive valid MP3 frames we 40 | * need to see before we decide we are looking at a real MP3 file 41 | */ 42 | #define MIN_CONSEC_GOOD_FRAMES 4 43 | #define FRAME_HEADER_SIZE 4 44 | #define MIN_FRAME_SIZE 21 45 | #define NUM_SAMPLES 4 46 | 47 | typedef struct { 48 | unsigned int sync; 49 | unsigned int version; 50 | unsigned int layer; 51 | unsigned int crc; 52 | unsigned int bitrate; 53 | unsigned int freq; 54 | unsigned int padding; 55 | unsigned int extension; 56 | unsigned int mode; 57 | unsigned int mode_extension; 58 | unsigned int copyright; 59 | unsigned int original; 60 | unsigned int emphasis; 61 | } mp3header; 62 | 63 | typedef struct { 64 | char title [31]; 65 | char artist [31]; 66 | char album [31]; 67 | char year [5]; 68 | char comment [31]; 69 | unsigned char track[1]; 70 | unsigned char genre[1]; 71 | } id3tag; 72 | 73 | typedef struct { 74 | char *filename; 75 | FILE *file; 76 | off_t datasize; 77 | int header_isvalid; 78 | mp3header header; 79 | int id3_isvalid; 80 | id3tag id3; 81 | int vbr; 82 | float vbr_average; 83 | int seconds; 84 | int frames; 85 | int badframes; 86 | } mp3info; 87 | 88 | int get_header (FILE * file, mp3header * header); 89 | int frame_length(mp3header * header); 90 | int header_layer(mp3header * h); 91 | int header_bitrate(mp3header * h); 92 | int sameConstant(mp3header * h1, mp3header * h2); 93 | void get_mp3_info(char *f, struct audio *); 94 | int get_id3 (mp3info * mp3, struct audio *); 95 | char *unpad(char *string); 96 | int header_frequency(mp3header * h); 97 | char *header_emphasis(mp3header * h); 98 | char *header_mode(mp3header * h); 99 | int get_first_header(mp3info * mp3, int startpos); 100 | int get_next_header(mp3info * mp3); 101 | -------------------------------------------------------------------------------- /zipscript/include/multimedia.h: -------------------------------------------------------------------------------- 1 | #include "avi.h" 2 | 3 | #ifndef _MULTIMEDIA_H_ 4 | #define _MULTIMEDIA_H_ 5 | 6 | char *get_preset(char[4]); 7 | char *safe_genre(char *); 8 | int get_audio_header_start(int); 9 | 10 | void get_audio_info(char *, struct audio *); 11 | void get_mpeg_audio_info(char *, struct audio *); 12 | #ifdef HAVE_FLAC_HEADERS 13 | void get_flac_audio_info(char *, struct audio *); 14 | #endif 15 | 16 | const unsigned char *fourcc(FOURCC); 17 | void avierror(const char *); 18 | DWORD get32(FILE *); 19 | WORD get16(FILE *); 20 | int avinfo(char *, struct VIDEO *); 21 | 22 | #endif 23 | -------------------------------------------------------------------------------- /zipscript/include/ng-chown.h: -------------------------------------------------------------------------------- 1 | #ifndef NG_CHOWN_H 2 | #define NG_CHOWN_H 3 | 4 | #include 5 | 6 | int 7 | #if defined(__linux__) || defined(_OSX_) || defined(_BSD_) 8 | selector3(const struct dirent *d); 9 | #else 10 | selector3(struct dirent *d); 11 | #endif 12 | 13 | short int matchpath2(char *, char *); 14 | int myscandir(char *, char *); 15 | int myscan(int, int, int, int, int, int, int, char *, char *); 16 | uid_t get_gluid(char *, char *); 17 | gid_t get_glgid(char *, char *); 18 | void *ng_realloc3(void *, int); 19 | void *ng_free3(void *); 20 | #endif 21 | -------------------------------------------------------------------------------- /zipscript/include/objects.h: -------------------------------------------------------------------------------- 1 | #ifndef _OBJECTS_H_ 2 | #define _OBJECTS_H_ 3 | 4 | #include 5 | #ifdef _WITH_SS5 6 | #include "constants.ss5.h" 7 | #else 8 | #include "constants.h" 9 | #endif 10 | #include 11 | #include 12 | #include 13 | 14 | #ifndef PATH_MAX 15 | #define _LIMITS_H_ 16 | #if defined(_SunOS_) 17 | #include 18 | #elif defined(_BSD_) || defined(_OSX_) 19 | #include 20 | #else 21 | #include 22 | #include 23 | #endif 24 | #endif 25 | 26 | #ifndef PATH_MAX 27 | #define PATH_MAX 1024 28 | #define NAME_MAX 255 29 | #define _ALT_MAX 30 | #endif 31 | 32 | #if NAME_MAX%4 33 | #define NAMEMAX NAME_MAX+4-NAME_MAX%4 34 | #else 35 | #define NAMEMAX NAME_MAX 36 | #endif 37 | 38 | #include "../conf/zsconfig.h" 39 | #include "../include/zsconfig.defaults.h" 40 | 41 | struct USERINFO { 42 | char name[24]; /* Username */ 43 | off_t bytes; /* Bytes uploaded */ 44 | unsigned long speed; /* Bytes per second */ 45 | unsigned int files; /* Files uploaded */ 46 | unsigned int pos; /* User position */ 47 | unsigned int group; /* Primary group number */ 48 | 49 | unsigned long long dayup; /* Day up stats */ 50 | unsigned long long wkup; /* Week */ 51 | unsigned long long monthup;/* Month */ 52 | unsigned long long allup; /* Alltime */ 53 | }; 54 | 55 | struct GROUPINFO { 56 | char name[24]; /* Groupname */ 57 | off_t bytes; /* Bytes uploaded */ 58 | unsigned long speed; /* Bytes per second */ 59 | unsigned int files; /* Files uploaded */ 60 | unsigned int pos; /* Group position */ 61 | unsigned int users; /* Users in group; */ 62 | }; 63 | 64 | struct audio { 65 | char id3_artist[NAME_MAX]; 66 | char id3_title [NAME_MAX]; 67 | char id3_album [NAME_MAX]; 68 | char id3_year[5]; 69 | char bitrate[8]; /* MLP based lossless is 18 Mbit/s */ 70 | char samplingrate[10]; /* SACD is 2822400 Hz */ 71 | char *id3_genre; 72 | unsigned char id3_genre_id; 73 | char *layer; 74 | char *codec; 75 | char *channelmode; 76 | char vbr_version_string[NAME_MAX]; 77 | char vbr_preset[15]; 78 | int is_vbr; 79 | char vbr_oldnew; 80 | int vbr_quality; 81 | int vbr_minimum_bitrate; 82 | int vbr_noiseshaping; 83 | char vbr_stereo_mode[10]; 84 | char vbr_unwise[4]; 85 | char vbr_source[10]; 86 | }; 87 | 88 | struct VIDEO { 89 | int height; 90 | int width; 91 | double fps; 92 | char vids[30]; 93 | char fourcc[15]; 94 | long hz; 95 | int ch; 96 | char audio[30]; 97 | char audiotype[30]; 98 | }; 99 | 100 | struct current_user { 101 | char name [24]; 102 | char group [24]; 103 | char tagline [255]; 104 | short int pos; 105 | }; 106 | 107 | struct current_file { 108 | char name[NAME_MAX]; 109 | char unlink[NAME_MAX]; 110 | unsigned long speed; 111 | off_t size; 112 | char compression_method; 113 | }; 114 | 115 | struct race_total { 116 | unsigned int start_time; 117 | unsigned int stop_time; 118 | unsigned char users; 119 | unsigned char groups; 120 | int files; 121 | int files_missing; 122 | int files_bad; 123 | unsigned char nfo_present; 124 | unsigned long speed; 125 | off_t size; 126 | off_t bad_size; 127 | }; 128 | 129 | struct misc { 130 | char old_leader[24]; 131 | char release_name[PATH_MAX]; 132 | char current_path[PATH_MAX]; 133 | char basepath[PATH_MAX]; 134 | char racer_list[1024]; 135 | char total_racer_list[1024]; 136 | char top_messages[2][2048]; 137 | char error_msg [80]; 138 | char progress_bar[15]; 139 | int release_type; 140 | unsigned char write_log; 141 | unsigned long fastest_user[2]; 142 | unsigned long slowest_user[2]; 143 | unsigned int data_completed; 144 | }; 145 | 146 | struct LOCATIONS { 147 | char *leader; 148 | char *nfo_incomplete; 149 | char *sample_incomplete; 150 | char *incomplete; 151 | char *sfv; 152 | char *sfvbackup; 153 | char *sfv_incomplete; 154 | char *race; 155 | char link_target[PATH_MAX]; 156 | char link_source[PATH_MAX]; 157 | char path[PATH_MAX]; 158 | char basepath[PATH_MAX]; 159 | unsigned int length_path; 160 | unsigned int length_zipdatadir; 161 | unsigned int in_cd_dir; 162 | }; 163 | 164 | struct VARS { 165 | struct current_user user; 166 | struct current_file file; 167 | struct race_total total; 168 | struct misc misc; 169 | struct audio audio; 170 | struct VIDEO avinfo; 171 | unsigned char section; 172 | char sectionname[128]; 173 | char headpath[PATH_MAX]; 174 | unsigned int data_incrementor; 175 | unsigned int data_in_use; 176 | unsigned int data_queue; 177 | unsigned int data_type; 178 | }; 179 | 180 | /* passing this around is a lot easier than passing 181 | * a lot of other shit around */ 182 | typedef struct { 183 | struct USERINFO **ui; 184 | struct GROUPINFO **gi; 185 | struct VARS v; 186 | struct LOCATIONS l; 187 | } GLOBAL; /* reconsider this name */ 188 | 189 | /* sfv_version - must be > 5. Should not be any need to add a version 190 | * for racedata - if either sfv_data or racedata changes, they both 191 | * should be removed */ 192 | #define sfv_version 17 193 | 194 | #endif 195 | -------------------------------------------------------------------------------- /zipscript/include/postdel.h: -------------------------------------------------------------------------------- 1 | #ifndef POSTDEL_H 2 | #define POSTDEL_H 3 | 4 | #include "objects.h" 5 | 6 | /* COMMENT THESE */ 7 | void writelog(GLOBAL *, char *, char *); 8 | unsigned char get_filetype_postdel(GLOBAL *, char *); 9 | 10 | #endif 11 | -------------------------------------------------------------------------------- /zipscript/include/postunnuke.h: -------------------------------------------------------------------------------- 1 | #ifndef POSTUNNUKE_H 2 | #define POSTUNNUKE_H 3 | 4 | #define UNNUKE_STR "site unnuke " 5 | #define UNNUKE_STRLEN 12 6 | 7 | #endif 8 | -------------------------------------------------------------------------------- /zipscript/include/print_config.h: -------------------------------------------------------------------------------- 1 | #ifndef PRINTCONFIG_H_200706231538 2 | #define PRINTCONFIG_H_200706231538 3 | 4 | void print_nondefault_config(void); 5 | void print_full_config(void); 6 | 7 | #endif 8 | -------------------------------------------------------------------------------- /zipscript/include/race-file.h: -------------------------------------------------------------------------------- 1 | #ifndef _RACE_FILE_H_ 2 | #define _RACE_FILE_H_ 3 | 4 | #include 5 | #include "objects.h" 6 | #include "zsfunctions.h" 7 | 8 | /* this is what we write to racedata files */ 9 | typedef struct { 10 | unsigned int crc32, 11 | speed; /* should become unsigned long, but causes 12 | * backwards incompatibility; might be overcome 13 | * via sfv_version checking when using readrace() 14 | */ 15 | off_t size; 16 | time_t start_time; 17 | unsigned char status; 18 | unsigned char dummy1; 19 | char fname[NAMEMAX], 20 | uname[24], 21 | group[24], 22 | dummy2[31], /* not used anymore, */ 23 | dummy3[31]; /* kept for compatibilty */ 24 | } RACEDATA; 25 | 26 | /* this is put in sfvdata files */ 27 | typedef struct { 28 | unsigned int crc32; 29 | char fname[NAMEMAX]; 30 | } SFVDATA; 31 | 32 | /* this is what we put in a special 'head' file for version control, lock etc */ 33 | typedef struct { 34 | unsigned int data_version, // version control. 35 | data_type, // type of release. 36 | data_in_use, // which program currently holds the lock. 37 | data_incrementor, // a check to see if nothing else wants the lock. 38 | data_queue, // positions in queue. 39 | data_qcurrent, // current position in queue. 40 | data_pid, // the pid of the process holding the lock. 41 | data_completed; // flag to mark release as complete. 42 | } HEADDATA; 43 | 44 | extern unsigned int readsfv(const char *, struct VARS *, int); 45 | extern char *get_first_filename_from_sfvdata(const char *); 46 | extern int parse_sfv(char *, GLOBAL *, DIR *); 47 | extern void update_sfvdata(const char *, const char *, const unsigned int); 48 | extern void delete_sfv(const char *, struct VARS *); 49 | extern void readrace(const char *, struct VARS *, struct USERINFO **, struct GROUPINFO **); 50 | extern void maketempdir(char *); 51 | extern void read_write_leader(const char *, struct VARS *, struct USERINFO *); 52 | extern void testfiles(struct LOCATIONS *, struct VARS *, int); 53 | extern int copysfv(const char *, const char *, struct VARS *); 54 | extern void create_indexfile(const char *, struct VARS *, char *); 55 | extern short clear_file(const char *, char *); 56 | extern void writerace(const char *, struct VARS *, unsigned int, unsigned char); 57 | extern void remove_from_race(const char *, const char *, struct VARS *); 58 | extern int verify_racedata(const char *, struct VARS *); 59 | extern int create_lock(struct VARS *, const char *, unsigned int, unsigned int, unsigned int); 60 | extern void remove_lock(struct VARS *); 61 | extern int update_lock(struct VARS *, unsigned int, unsigned int); 62 | extern short match_file(char *, char *); 63 | extern int check_rarfile(const char *); 64 | extern int check_zipfile(const char *, const char *, int); 65 | extern void removedir(const char *); 66 | extern void create_dirlist(const char *, char *, const int); 67 | extern int filebanned_match(const char *); 68 | extern int lenient_compare(char *, char *); 69 | extern int read_headdata(const char *); 70 | #endif 71 | 72 | -------------------------------------------------------------------------------- /zipscript/include/scandir.h: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | /* This function is only required for SunOS, all other supported OS 7 | have this function in their system library */ 8 | 9 | int scandir(const char *, struct dirent ***, 10 | int (*select)(const struct dirent *), 11 | int (*compar)(const struct dirent **, const struct dirent **)); 12 | 13 | int alphasort(const struct dirent **, const struct dirent **); 14 | -------------------------------------------------------------------------------- /zipscript/include/stats.h: -------------------------------------------------------------------------------- 1 | #ifndef _STATS_H_ 2 | #define _STATS_H_ 3 | 4 | struct userdata { 5 | unsigned long long allup_bytes; 6 | unsigned long long monthup_bytes; 7 | unsigned long long wkup_bytes; 8 | unsigned long long dayup_bytes; 9 | short name; 10 | }; 11 | 12 | void updatestats_free(GLOBAL *); 13 | void updatestats(struct VARS *, struct USERINFO **, struct GROUPINFO **, char *, char *, off_t, unsigned long, unsigned int); 14 | void sortstats(struct VARS *, struct USERINFO **, struct GROUPINFO **); 15 | void showstats(struct VARS *, struct USERINFO **, struct GROUPINFO **); 16 | void get_stats(struct VARS *, struct USERINFO **); 17 | 18 | #endif 19 | -------------------------------------------------------------------------------- /zipscript/include/strsep.h: -------------------------------------------------------------------------------- 1 | #ifndef STRSEP_H 2 | #define STRSEP_H 3 | char *strsep(char **, const char *); 4 | #endif 5 | -------------------------------------------------------------------------------- /zipscript/include/zsfunctions.h: -------------------------------------------------------------------------------- 1 | #ifndef _ZSFUNCTIONS_H_ 2 | #define _ZSFUNCTIONS_H_ 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #ifdef USE_HSREGEX 9 | #include "hsregex.h" 10 | #else 11 | #include 12 | #endif 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | #include 19 | #include 20 | #include 21 | #include 22 | #ifndef PATH_MAX 23 | #define _LIMITS_H_ 24 | #ifdef _SunOS_ 25 | #include 26 | #else 27 | #include 28 | #endif 29 | #endif 30 | 31 | #ifndef PATH_MAX 32 | #define PATH_MAX 1024 33 | #define NAME_MAX 255 34 | #define _ALT_MAX 35 | #endif 36 | 37 | #ifdef HAVE_CONFIG_H 38 | # include "config.h" 39 | #endif 40 | 41 | #include "objects.h" 42 | #include "macros.h" 43 | #ifdef _WITH_SS5 44 | #include "constants.ss5.h" 45 | #else 46 | #include "constants.h" 47 | #endif 48 | 49 | #if ( debug_mode == TRUE ) 50 | #include 51 | #endif 52 | 53 | #define createzerofile(filename) fclose(fopen(filename, "a+")) 54 | 55 | /* 56 | * Remove the portion of PARAM matched by PATTERN according to OP, where OP 57 | * can have one of 4 values: RP_LONG_LEFT remove longest matching portion 58 | * at start of PARAM RP_SHORT_LEFT remove shortest matching portion at 59 | * start of PARAM RP_LONG_RIGHT remove longest matching portion at end of 60 | * PARAM RP_SHORT_RIGHT remove shortest matching portion at end of PARAM 61 | */ 62 | 63 | #define RP_LONG_LEFT 1 64 | #define RP_SHORT_LEFT 2 65 | #define RP_LONG_RIGHT 3 66 | #define RP_SHORT_RIGHT 4 67 | 68 | struct GROUP { 69 | char *name; 70 | gid_t id; 71 | }; 72 | 73 | struct USER { 74 | char *name; 75 | uid_t id; 76 | }; 77 | 78 | /*extern struct USERINFO **userI; 79 | extern struct GROUPINFO **groupI; 80 | extern struct VARS raceI;*/ 81 | extern struct dirent **dirlist; 82 | extern unsigned int direntries; 83 | 84 | extern void d_log(char *,...); 85 | 86 | extern void create_missing(char *); 87 | extern char *findfileext(DIR *, char *); 88 | extern char *findfileextsub(const char *, char *, char *); 89 | extern char *findfileextparent(DIR *, char *); 90 | extern char *findfileextfromlist(DIR *, char *); 91 | 92 | extern int findfileextcount(DIR *, char *); 93 | extern int file_count(DIR *); 94 | extern unsigned int hexstrtodec(char *); 95 | #if defined(__linux__) || defined(__NetBSD__) 96 | extern int selector(const struct dirent *); 97 | #else 98 | extern int selector(struct dirent *); 99 | #endif 100 | 101 | /*extern void rescandir(int); 102 | extern void rescanparent(int);*/ 103 | extern void del_releasedir(DIR *, char *); 104 | extern void strtolower(char *); 105 | extern void space_to_dot(char *); 106 | extern void unlink_missing(char *); 107 | extern char israr(char *); 108 | //extern char isvideo(char *); 109 | extern void buffer_progress_bar(struct VARS *); 110 | extern void move_progress_bar(unsigned char, struct VARS *, struct USERINFO **, struct GROUPINFO **); 111 | extern int check_dupefile(DIR *, char *); 112 | extern long findfile(DIR *, char *); 113 | extern char *findfilename(char *, char *, struct VARS *); 114 | extern char *check_nocase_linkname(char *, char *); 115 | extern void removedotfiles(DIR *); 116 | extern void removecomplete(int); 117 | extern short matchpath(char *, char *); 118 | extern short matchpartialpath(char *, char *); 119 | extern short matchpartialdirname(char *, char *, char *); 120 | extern short strcomp(char *, char *); 121 | extern short subcomp(char *, char *); 122 | extern short fileexists(char *); 123 | extern void createlink(char *, char *, char *, char *); 124 | extern void readsfv_ffile(struct VARS *); 125 | extern void get_rar_info(char *, struct VARS *); 126 | extern int execute(char *); 127 | 128 | #ifdef USING_GLFTPD 129 | extern char *get_g_name(int); 130 | extern char *get_u_name(int); 131 | extern int buffer_groups(char *, int); 132 | extern int buffer_users(char *, int); 133 | #endif 134 | 135 | extern off_t sfv_compare_size(char *, off_t); 136 | extern void mark_as_bad(char *); 137 | extern int extractDirname(char *dirname, char *absoluteDirname); 138 | extern void createstatusbar(const char *bar); 139 | extern int chmod_each(const char *list, mode_t mode); 140 | 141 | 142 | /* split from zsipscript-c.c */ 143 | extern void writelog(GLOBAL *, char *, char *); 144 | extern void buffer_paths(GLOBAL *, char [2][PATH_MAX], int *, int); 145 | extern void remove_nfo_indicator(GLOBAL *); 146 | extern void remove_sample_indicator(GLOBAL *); 147 | extern void getrelname(GLOBAL *); 148 | extern unsigned char get_filetype(GLOBAL *, char *); 149 | 150 | #if ( audio_group_sort == TRUE ) 151 | extern char *remove_pattern(char *, char *, int); 152 | #endif 153 | extern void *ng_realloc(void *, int, int, int, struct VARS *, int); 154 | extern void *ng_realloc2(void *, int, int, int, int); 155 | extern void *ng_free(void *); 156 | extern int copyfile(char *, char *); 157 | extern int make_sfv(char *); 158 | extern unsigned int match_lenient(DIR *, char *); 159 | extern unsigned int insampledir(char *); 160 | #endif 161 | 162 | extern int _err_file_banned(const char *fn, struct VARS *v); 163 | -------------------------------------------------------------------------------- /zipscript/src/Makefile.in: -------------------------------------------------------------------------------- 1 | prefix=@INSTALLPATH@ 2 | datapath=/ftp-data 3 | storage=/ftp-data/pzs-ng 4 | bindir=$(prefix)/bin 5 | using_glftpd=@USING_GLFTPD@ 6 | 7 | CC=@CC@ 8 | CFLAGS=@CFLAGS@ @STATIC@ @NOFORMAT@ @USING_GLFTPD@ @GLVERSION@ @FLAC_HEADERS@ -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE @DEFS@ -I../include/ -I../../ -I../../lib/ 9 | LDFLAGS=@LDFLAGS@ 10 | RM=@RM@ -f 11 | INSTALL=@INSTALL@ 12 | STRLCPY=../../lib/strl/strlcpy.o 13 | 14 | SUNOBJS=@SUNOBJS@ 15 | UNIVERSAL=stats.o convert.o race-file.o helpfunctions.o zsfunctions.o mp3info.o abs2rel.o $(SUNOBJS) $(STRLCPY) 16 | ZS-OBJECTS=zipscript-c.o dizreader.o complete.o multimedia.o audiosort.o crc.o print_config.o $(UNIVERSAL) 17 | PD-OBJECTS=postdel.o dizreader.o multimedia.o crc.o $(UNIVERSAL) 18 | RS-OBJECTS=racestats.o dizreader.o crc.o $(UNIVERSAL) 19 | AS-OBJECTS=multimedia.o audiosort.o audiosort-bin.o crc.o $(UNIVERSAL) 20 | CU-OBJECTS=cleanup.o 21 | #IL-OBJECTS=incomplete-list.o 22 | DC-OBJECTS=datacleaner.o 23 | UD-OBJECTS=ng-undupe.o $(STRLCPY) 24 | DD-OBJECTS=ng-deldir.o $(STRLCPY) 25 | SC-OBJECTS=rescan.o dizreader.o complete.o crc.o multimedia.o audiosort.o $(UNIVERSAL) 26 | PU-OBJECTS=postunnuke.o dizreader.o complete.o crc.o multimedia.o audiosort.o $(UNIVERSAL) 27 | CH-OBJECTS=ng-chown.o 28 | #ZS-DEPEND=cleanup.o incomplete-list.o complete.o datacleaner.o postdel.o racestats.o rescan.o zipscript-c.o multimedia.o $(UNIVERSAL) 29 | ZS-DEPEND=cleanup.o complete.o datacleaner.o postdel.o racestats.o rescan.o zipscript-c.o multimedia.o $(UNIVERSAL) 30 | 31 | all: postunnuke ng-undupe ng-deldir zipscript-c postdel racestats cleanup datacleaner rescan ng-chown audiosort 32 | 33 | $(ZS-DEPEND): ../conf/zsconfig.h 34 | 35 | strsep.o: 36 | $(CC) $(CFLAGS) -o strsep.o -c strsep.c 37 | scandir.o: 38 | $(CC) $(CFLAGS) -o scandir.o -c scandir.c 39 | 40 | zipscript-c: $(ZS-OBJECTS) $(ZS-DEPEND) $(SUNOBJS) 41 | $(CC) $(CFLAGS) -o $@ $(ZS-OBJECTS) $(SUNOBJS) $(LDFLAGS) 42 | 43 | postdel: $(PD-OBJECTS) 44 | $(CC) $(CFLAGS) -o $@ $(PD-OBJECTS) $(LDFLAGS) 45 | 46 | racestats: $(RS-OBJECTS) 47 | $(CC) $(CFLAGS) -o $@ $(RS-OBJECTS) 48 | 49 | cleanup: $(CU-OBJECTS) 50 | $(CC) $(CFLAGS) -o $@ $(CU-OBJECTS) $(SUNOBJS) 51 | 52 | datacleaner: $(DC-OBJECTS) 53 | $(CC) $(CFLAGS) -o $@ $(DC-OBJECTS) $(SUNOBJS) 54 | 55 | ng-undupe: $(UD-OBJECTS) 56 | $(CC) $(CFLAGS) -o $@ $(UD-OBJECTS) 57 | 58 | ng-deldir: $(DD-OBJECTS) 59 | $(CC) $(CFLAGS) -o $@ $(DD-OBJECTS) 60 | 61 | ng-chown: $(CH-OBJECTS) 62 | $(CC) $(CFLAGS) -o $@ $(CH-OBJECTS) $(SUNOBJS) 63 | 64 | audiosort: $(AS-OBJECTS) 65 | $(CC) $(CFLAGS) -o $@ $(AS-OBJECTS) $(LDFLAGS) 66 | 67 | rescan: $(SC-OBJECTS) 68 | $(CC) $(CFLAGS) -o $@ $(SC-OBJECTS) $(LDFLAGS) 69 | 70 | postunnuke: $(PU-OBJECTS) 71 | $(CC) $(CFLAGS) -o $@ $(PU-OBJECTS) $(LDFLAGS) 72 | 73 | install: 74 | if [ "x$(using_glftpd)" != "x" ] && [ ! -e "$(bindir)" ]; then exit 1; fi 75 | if [ ! -e "$(bindir)" ]; then mkdir -p -m755 "$(bindir)"; fi 76 | if [ "x$(using_glftpd)" != "x" ] && [ ! -e "$(prefix)$(storage)" ]; then mkdir -p -m777 "$(prefix)$(storage)"; fi 77 | -chown 0:0 $(prefix)$(storage) 78 | -chmod 4777 $(prefix)$(storage) 79 | if [ -e $(prefix)$(datapath)/logs/glftpd.log ]; then chmod 666 $(prefix)$(datapath)/logs/glftpd.log; fi 80 | install -m0755 zipscript-c "$(bindir)" 81 | install -m0755 postdel "$(bindir)" 82 | install -m0755 racestats "$(bindir)" 83 | install -m0755 cleanup "$(bindir)" 84 | install -m0755 datacleaner "$(bindir)" 85 | install -m0755 rescan "$(bindir)" 86 | install -m4755 ng-undupe "$(bindir)" 87 | install -m4755 ng-deldir "$(bindir)" 88 | install -m0755 audiosort "$(bindir)" 89 | install -m0755 postunnuke "$(bindir)" 90 | install -m4755 ng-chown "$(bindir)" 91 | if [ -d "$(prefix)$(datapath)/misc" ] && [ ! -e "$(prefix)$(datapath)/misc/banned_filelist.txt" ]; then cp -f banned_filelist.txt $(prefix)$(datapath)/misc/; fi 92 | 93 | distclean: clean 94 | 95 | clean: 96 | $(RM) zipscript-c postdel postunnuke racestats cleanup datacleaner rescan ng-undupe ng-deldir ng-chown audiosort 97 | 98 | uninstall: 99 | rm -rf "$(prefix)$(storage)" 100 | rm -f "$(bindir)"/{zipscript-c,postdel,postunnuke,racestats,cleanup,datacleaner,rescan,ng-undupe,ng-deldir,ng-chown,audiosort} 101 | 102 | strip: 103 | strip zipscript-c postdel postunnuke racestats cleanup datacleaner rescan ng-undupe ng-deldir ng-chown audiosort 104 | -------------------------------------------------------------------------------- /zipscript/src/abs2rel.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1997 Shigio Yamaguchi. All rights reserved. Copyright (c) 3 | * 1999 Tama Communications Corporation. All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions are 7 | * met: 1. Redistributions of source code must retain the above copyright 8 | * notice, this list of conditions and the following disclaimer. 2. 9 | * Redistributions in binary form must reproduce the above copyright notice, 10 | * this list of conditions and the following disclaimer in the documentation 11 | * and/or other materials provided with the distribution. 12 | * 13 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND ANY 14 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 15 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 16 | * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR 17 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 18 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 19 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 20 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 21 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 22 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 23 | * SUCH DAMAGE. 24 | */ 25 | 26 | /* 27 | * abs2rel: convert an absolute path name into relative. 28 | * 29 | * i) path absolute path 30 | * i) base base directory (must be absolute path) 31 | * o) result result buffer 32 | * i) size size of result buffer 33 | * r) != NULL: relative path == NULL: error 34 | */ 35 | 36 | #include 37 | #include 38 | #include 39 | 40 | #include "abs2rel.h" 41 | 42 | char * 43 | abs2rel(const char *path, const char *base, char *result, const size_t size) 44 | { 45 | const char *pp, *bp, *branch; 46 | /* 47 | * endp points the last position which is safe in the result buffer. 48 | */ 49 | const char *endp = result + size - 1; 50 | char *rp; 51 | 52 | if (*path != '/') { 53 | if ((unsigned int)strlen(path) >= size) 54 | goto erange; 55 | strcpy(result, path); 56 | goto finish; 57 | } else if (*base != '/' || !size) { 58 | errno = EINVAL; 59 | return (NULL); 60 | } else if (size == 1) 61 | goto erange; 62 | /* 63 | * seek to branched point. 64 | */ 65 | branch = path; 66 | for (pp = path, bp = base; *pp && *bp && *pp == *bp; pp++, bp++) 67 | if (*pp == '/') 68 | branch = pp; 69 | if ((*pp == 0 || (*pp == '/' && *(pp + 1) == 0)) && 70 | (*bp == 0 || (*bp == '/' && *(bp + 1) == 0))) { 71 | rp = result; 72 | *rp++ = '.'; 73 | if (*pp == '/' || *(pp - 1) == '/') 74 | *rp++ = '/'; 75 | if (rp > endp) 76 | goto erange; 77 | *rp = 0; 78 | goto finish; 79 | } 80 | if ((*pp == 0 && *bp == '/') || (*pp == '/' && *bp == 0)) 81 | branch = pp; 82 | /* 83 | * up to root. 84 | */ 85 | rp = result; 86 | for (bp = base + (branch - path); *bp; bp++) 87 | /* fixed by iwdisb */ 88 | if (*bp == '/' && *(bp + 1) != 0 && *(bp + 1) != '/') { 89 | if (rp + 3 > endp) 90 | goto erange; 91 | *rp++ = '.'; 92 | *rp++ = '.'; 93 | *rp++ = '/'; 94 | } 95 | if (rp > endp) 96 | goto erange; 97 | *rp = 0; 98 | /* 99 | * down to leaf. 100 | */ 101 | if (*branch) { 102 | if (rp + (int)strlen(branch + 1) > endp) 103 | goto erange; 104 | strcpy(rp, branch + 1); 105 | } else 106 | *--rp = 0; 107 | finish: 108 | return result; 109 | erange: 110 | errno = ERANGE; 111 | return (NULL); 112 | } 113 | 114 | -------------------------------------------------------------------------------- /zipscript/src/audiosort-bin.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | #include "../conf/zsconfig.h" 7 | #include "zsfunctions.h" 8 | #include "audiosort.h" 9 | 10 | int main(int argc, char *argv[]) 11 | { 12 | char targetDir[PATH_MAX]; 13 | char cwdDir[PATH_MAX]; 14 | 15 | #if ( program_uid > 0 ) 16 | setegid(program_gid); 17 | seteuid(program_uid); 18 | #endif 19 | 20 | umask(0666 & 000); 21 | 22 | if (argc > 1) 23 | { 24 | if (argv[1][strlen(argv[1])-1] == '/') 25 | argv[1][strlen(argv[1])-1] = '\0'; 26 | 27 | if (*argv[1] == '/') 28 | { 29 | snprintf(targetDir, PATH_MAX, "%s", argv[1]); 30 | d_log("audioSort: using argv[1].\n"); 31 | } 32 | else 33 | { 34 | if (!getcwd(cwdDir, PATH_MAX)) { 35 | d_log("audioSort: Failed to getcwd: %s\n", strerror(errno)); 36 | } 37 | #if (debug_announce) 38 | printf("debug info: argv[1] = '%s'\n", argv[1]); 39 | printf("debug info: PWD = '%s'\n", getenv("PWD")); 40 | printf("debug info: getcwd() = '%s'\n", cwdDir); 41 | #else 42 | d_log("audioSort-bin: argv[1] = '%s'\n", argv[1]); 43 | d_log("audioSort-bin: PWD = '%s'\n", getenv("PWD")); 44 | d_log("audioSort-bin: getcwd() = '%s'\n", cwdDir); 45 | #endif 46 | if (getenv("PWD") != NULL) { 47 | snprintf(targetDir, PATH_MAX, "%s/%s", getenv("PWD"), argv[1]); 48 | d_log("audioSort: using PWD + argv[1].\n"); 49 | } else { 50 | d_log("audioSort: using getcwd() + argv[1].\n"); 51 | if (getcwd(cwdDir, PATH_MAX) == NULL) { 52 | d_log("audioSort: could not get current working dir: %s\n", strerror(errno)); 53 | printf("Something bad happened when trying to decide what dir to resort.\n"); 54 | return 1; 55 | } 56 | snprintf(targetDir, PATH_MAX, "%s/%s", cwdDir, argv[1]); 57 | } 58 | } 59 | } 60 | else 61 | { 62 | if (getenv("PWD") != NULL) 63 | { 64 | snprintf(targetDir, PATH_MAX, "%s", getenv("PWD")); 65 | d_log("audioSort: using PWD.\n"); 66 | } 67 | else 68 | { 69 | d_log("audioSort: using getcwd().\n"); 70 | if (getcwd(targetDir, PATH_MAX) == NULL) 71 | { 72 | d_log("audioSort: could not get current working dir: %s\n", strerror(errno)); 73 | printf("Something bad happened when trying to decide what dir to resort.\n"); 74 | return 1; 75 | } 76 | } 77 | } 78 | 79 | d_log("audioSort: resorting dir %s.\n", targetDir); 80 | 81 | printf("Resorting %s. :-)\n", targetDir); 82 | audioSortDir(targetDir); 83 | printf("Done!\n"); 84 | 85 | return 0; 86 | } 87 | 88 | -------------------------------------------------------------------------------- /zipscript/src/datacleaner.c: -------------------------------------------------------------------------------- 1 | /* ADD MORE ERROR CHECKING IN THIE FILE */ 2 | 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | 11 | #include "objects.h" 12 | #include "macros.h" 13 | #include "../conf/zsconfig.h" 14 | #include "../include/zsconfig.defaults.h" 15 | 16 | #ifndef PATH_MAX 17 | #define _LIMITS_H_ 18 | #ifdef _SunOS_ 19 | #include 20 | #else 21 | #include 22 | #endif 23 | #endif 24 | 25 | #ifdef _SunOS_ 26 | #include "scandir.h" 27 | #endif 28 | 29 | #include "datacleaner.h" 30 | 31 | int 32 | main(int argc, char **argv) 33 | { 34 | int zd_length; 35 | char st[PATH_MAX]; 36 | char *wd; 37 | DIR *od; 38 | 39 | zd_length = (int)strlen(storage); 40 | 41 | if (argc == 1) { 42 | check_dir_loop(storage, zd_length); 43 | } else { 44 | if ((zd_length + 1 + (int)strlen(argv[1])) < PATH_MAX) { 45 | if ( !strncmp(argv[1], "RMD ", 4)) { 46 | /* script is called as a cscript for RMD */ 47 | if (!strncmp(argv[1] + 4, "/", 1)) { 48 | /* client uses full path to dir */ 49 | sprintf(st, storage "/%s/%s", sitepath_dir, argv[1] + 4); 50 | } else { 51 | /* client give only name of dir */ 52 | if (( wd = getcwd(NULL, PATH_MAX)) == NULL) { 53 | exit (2); 54 | } else { 55 | sprintf(st, storage "/%s/%s", wd, argv[1] + 4); 56 | free(wd); 57 | } 58 | } 59 | } else if ( !strncmp(argv[1], "/", 1)) { 60 | /* script is called with an argument from (chroot) shell */ 61 | sprintf(st, storage "/%s", argv[1]); 62 | printf("Checking dir: %s\n", st); 63 | } else { 64 | /* script is called with bad args - scanning current dirs */ 65 | if (( wd = getcwd(NULL, PATH_MAX)) == NULL) { 66 | exit (2); 67 | } else { 68 | sprintf(st, storage "/%s", wd); 69 | free(wd); 70 | } 71 | } 72 | } 73 | /* check subdirs */ 74 | check_dir_loop(st, zd_length); 75 | 76 | /* check current dir */ 77 | if (( od = opendir(st + zd_length)) == NULL) { 78 | remove_dir_loop(st); 79 | rmdir(st); 80 | } else { 81 | closedir(od); 82 | } 83 | } 84 | return 0; 85 | } 86 | 87 | void 88 | remove_dir_loop(char *path) 89 | { 90 | DIR *dir; 91 | struct dirent *dp; 92 | char target[PATH_MAX]; 93 | struct stat sb; 94 | 95 | if ((chdir(path)) == -1) { 96 | perror(path); 97 | exit(EXIT_FAILURE); 98 | } 99 | 100 | dir = opendir(path); 101 | while ((dp = readdir(dir))) { 102 | if (dp->d_name[0] != '.' || (dp->d_name[0] == '.' && strlen(dp->d_name) > 2)) { 103 | stat(dp->d_name, &sb); 104 | if (S_ISDIR(sb.st_mode)) { 105 | sprintf(target, "%s/%s", path, dp->d_name); 106 | remove_dir_loop(target); 107 | rmdir(target); 108 | if (chdir(path) == -1) { 109 | perror(path); 110 | } 111 | } else 112 | unlink(dp->d_name); 113 | } 114 | } 115 | closedir(dir); 116 | } 117 | 118 | void 119 | check_dir_loop(char *path, int zd_length) 120 | { 121 | DIR *dir1, *dir2; 122 | struct dirent *dp; 123 | char target [PATH_MAX]; 124 | struct stat sb; 125 | 126 | if (chdir(path) == -1) { 127 | perror(path); 128 | exit(EXIT_FAILURE); 129 | } 130 | 131 | dir1 = opendir(path); 132 | while ((dp = readdir(dir1))) { 133 | if (dp->d_name[0] != '.') { 134 | stat(dp->d_name, &sb); 135 | if (S_ISDIR(sb.st_mode)) { 136 | sprintf(target, "%s/%s", path, dp->d_name); 137 | if ((dir2 = opendir(target + zd_length))) { 138 | closedir(dir2); 139 | check_dir_loop(target, zd_length); 140 | if (chdir(path) == -1) { 141 | perror(path); 142 | } 143 | } else { 144 | remove_dir_loop(target); 145 | rmdir(target); 146 | if (chdir(path) == -1) { 147 | perror(path); 148 | } 149 | } 150 | } 151 | } 152 | } 153 | closedir(dir1); 154 | } 155 | 156 | -------------------------------------------------------------------------------- /zipscript/src/dizreader.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | #include "dizreader.h" 9 | 10 | /* 11 | * ? = any char; & = character is not ... (ie &/ = character is not /) 12 | * # = total disk count; ! = chars 0-9, o & x 13 | * &! = character is not 0-9, o or x 14 | * 15 | * !!! USE LOWERCASE !!! 16 | */ 17 | char *search[] = { 18 | "[?!/##]", 19 | "(?!/##)", 20 | "[?!!/###]", 21 | "(?!!/###)", 22 | "[?/#]", 23 | "[?/##]", 24 | "(?/#)", 25 | "[disk:!!/##]", 26 | "[disk:?!/##]", 27 | "o?/o#", 28 | "disks[!!/##", 29 | " !/# ", 30 | " !!/##&/&!", 31 | "&/!!/## ", 32 | "[!!/#]", 33 | ": ?!/##&/", 34 | "xx/##", 35 | "", 36 | "x/##", 37 | "! of #", 38 | "? of #", 39 | "x of #", 40 | "ox of o#", 41 | "!! of ##", 42 | "?! of ##", 43 | "xx of ##"}; 44 | 45 | int strings = 25; 46 | 47 | /* REMOVE SPACES FROM STRING */ 48 | void 49 | removespaces(char *instr, int l) 50 | { 51 | int spaces = 0, cnt2 = 0, cnt; 52 | 53 | for (cnt = 0; cnt < l; cnt++) 54 | switch (instr[cnt]) { 55 | case '\0': 56 | case ' ': 57 | case '\n': 58 | if (!spaces) 59 | instr[cnt2++] = ' '; 60 | spaces++; 61 | break; 62 | default: 63 | instr[cnt2++] = tolower(instr[cnt]); 64 | spaces = 0; 65 | break; 66 | } 67 | instr[cnt2] = 0; 68 | } 69 | 70 | int 71 | //read_diz(char *filename) 72 | read_diz(void) 73 | { 74 | int pos , fd, diskc, control, tgt, cnt, cnt2; 75 | unsigned int cnt3, matches; 76 | char data [4096]; 77 | char disks [4]; 78 | 79 | // fd = open(filename, O_NONBLOCK); 80 | fd = open("file_id.diz", O_NONBLOCK); 81 | while ((tgt = read(fd, data, 4096)) > 0) { 82 | removespaces(data, tgt); 83 | for (cnt = 0; cnt < tgt; cnt++) 84 | for (cnt2 = 0; cnt2 < strings; cnt2++) { 85 | pos = matches = control = 0; 86 | disks[0] = disks[1] = disks[2] = disks[3] = '\0'; 87 | for (cnt3 = 0; (unsigned int)cnt3 <= ((unsigned int)strlen(search[cnt2]) - control); cnt3++) 88 | switch (search[cnt2][cnt3 + control]) { 89 | case '#': 90 | if (isdigit(data[cnt + cnt3]) || data[cnt + cnt3] == ' ' || data[cnt + cnt3] == 'o') { 91 | if (data[cnt + cnt3] == 'o') 92 | data[cnt + cnt3] = '0'; 93 | matches++; 94 | pos += sprintf(disks + pos, "%c", data[cnt + cnt3]); 95 | } break; 96 | case '?': 97 | matches++; 98 | break; 99 | case '!': 100 | if (isdigit(data[cnt + cnt3]) || data[cnt + cnt3] == 'o' || data[cnt + cnt3] == 'x') 101 | matches++; 102 | break; 103 | case '&': 104 | control++; 105 | if (!(search[cnt2][cnt3 + control] == '!' && (isdigit(data[cnt + cnt3]) || data[cnt + cnt3] == 'o' || data[cnt + cnt3] == 'x')) && data[cnt + cnt3] != search[cnt2][cnt3 + control]) 106 | matches++; 107 | break; 108 | default: 109 | if (search[cnt2][cnt3 + control] == data[cnt + cnt3]) 110 | matches++; 111 | break; 112 | } 113 | if ((unsigned int)matches == (unsigned int)strlen(search[cnt2]) - control && (diskc = strtol(disks, NULL, 10))) 114 | return diskc; 115 | } 116 | } 117 | close(fd); 118 | return 0; 119 | } 120 | -------------------------------------------------------------------------------- /zipscript/src/helpfunctions.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | #include "zsfunctions.h" 7 | #include "helpfunctions.h" 8 | 9 | /* First Version: ???????? ? 10 | * Modified: 20130117 Sked 11 | * Description: find the first occurance of any of delim in name 12 | */ 13 | char * 14 | find_first_of(char *name, const char *delim) 15 | { 16 | char *n_ptr = NULL; 17 | const char *d_ptr; 18 | 19 | if (name != NULL) { 20 | for (n_ptr = name; *n_ptr; n_ptr++) { 21 | for (d_ptr = delim; *d_ptr; d_ptr++) { 22 | if (*n_ptr == *d_ptr) 23 | return n_ptr; 24 | } 25 | } 26 | } 27 | 28 | return n_ptr; 29 | } 30 | 31 | /* First Version: ???????? ? 32 | * Modified: 20130117 Sked 33 | * Description: find the last occurance of any of delim in name 34 | */ 35 | char * 36 | find_last_of(char *name, const char *delim) 37 | { 38 | char *n_ptr, *result = NULL; 39 | const char *d_ptr; 40 | 41 | if (name != NULL) { 42 | for (result = n_ptr = name; *n_ptr; n_ptr++) { 43 | for (d_ptr = delim; *d_ptr; d_ptr++) { 44 | if (*n_ptr == *d_ptr) 45 | result = n_ptr; 46 | } 47 | } 48 | } 49 | 50 | return result; 51 | } 52 | 53 | /* First Version: ???????? ? 54 | * Modified: 20120926 Sked 55 | * Description: remove trailing given chars, modifying the string 56 | */ 57 | void 58 | tailstrip_chars(char *s, char *dels) 59 | { 60 | if (s && *s) { 61 | char *p = s + strlen(s) - 1; 62 | while (s-1 != p && strchr(dels, (int)*p) != NULL) 63 | --p; 64 | *(++p) = '\0'; 65 | } 66 | } 67 | 68 | /* First Version: ???????? ? 69 | * Modified: 20120926 Sked 70 | * Description: remove prefixing given chars, retunring the result 71 | */ 72 | char * 73 | prestrip_chars(char *s, char *dels) 74 | { 75 | if (s) 76 | while (*s && strchr(dels, (int)*s) != NULL) 77 | ++s; 78 | return s; 79 | } 80 | 81 | /* First Version: 20120925 Sked 82 | * Description: Removes all given characters from a string, modifying it 83 | */ 84 | void 85 | strip_chars(char *s, char *dels) 86 | { 87 | if (s != NULL) { 88 | char *p = s; 89 | while (*s) { 90 | if (strchr(dels, (int)*s) != NULL) { 91 | while (*p && strchr(dels, (int)*p) != NULL) 92 | ++p; 93 | } else { 94 | ++s; 95 | ++p; 96 | } 97 | *s = *p; 98 | } 99 | } 100 | } 101 | 102 | /* exclusive write lock */ 103 | void 104 | xlock(struct flock *fl, int fd, short type) 105 | { 106 | fl->l_start = fl->l_len = fl->l_pid = 0; 107 | fl->l_type = type; 108 | fl->l_whence = SEEK_SET; 109 | 110 | if (fcntl(fd, F_SETLKW, fl) == -1) { 111 | d_log("xlock: fcntl: %s\n", strerror(errno)); 112 | } 113 | } 114 | 115 | /* unlock exclusive lock */ 116 | void 117 | xunlock(struct flock *fl, int fd) 118 | { 119 | fl->l_type = F_UNLCK; 120 | if (fcntl(fd, F_SETLK, fl) == -1) { 121 | d_log("xunlock: fcntl: %s\n", strerror(errno)); 122 | } 123 | } 124 | 125 | -------------------------------------------------------------------------------- /zipscript/src/ng-undupe.c: -------------------------------------------------------------------------------- 1 | /* 2 | * UnDUPE.C - Clean the dupefile of unwanted data Works as far as i know 3 | * evilution @ efnet 02-25-99 4 | * 5 | * Fixed USAGE spelling error - Turranius 2004-01-04 6 | * 7 | * Modded/stripped for use with pzs-ng - psxc 2004-07-14 8 | * Fixed issues on 64bit - DuReX 2007-12-17 9 | * Compatibility for 64bit glftpds - Sked 2011-09-16 10 | * Try renaming prior to streaming, some cleanups - Sked 2011-09-20 11 | * 12 | */ 13 | 14 | #include 15 | #include 16 | #include 17 | #include 18 | #include 19 | #include 20 | #include 21 | #include "../conf/zsconfig.h" 22 | #include "../include/zsconfig.defaults.h" 23 | 24 | #ifdef HAVE_CONFIG_H 25 | # include "config.h" 26 | #endif 27 | 28 | #ifndef HAVE_STRLCPY 29 | # include "strl/strl.h" 30 | #endif 31 | 32 | /* Force structure alignment to 4 bytes (for 64bit support). */ 33 | #if ( GLVERSION != 20164 ) 34 | #pragma pack(push, 4) 35 | #endif 36 | 37 | /* 32-bit time values (for 64bit support). */ 38 | typedef int32_t time32_t; 39 | 40 | #if ( GLVERSION == 20164 ) 41 | struct dupeentry { 42 | char filename[256]; 43 | time_t timeup; 44 | char uploader[25]; 45 | }; 46 | #else 47 | struct dupeentry { 48 | char filename[256]; 49 | time32_t timeup; 50 | char uploader[25]; 51 | }; 52 | #endif 53 | 54 | /* Restore default structure alignment for non-critical structures. */ 55 | #if ( GLVERSION != 20164 ) 56 | #pragma pack(pop) 57 | #endif 58 | 59 | int 60 | main(int argc, char *argv[]) 61 | { 62 | FILE *fp, *fp2; 63 | char dupename[1024], data2[1024], dupefile[1024]; 64 | struct dupeentry buffer; 65 | 66 | if (argc != 2) { 67 | printf("Please give a filename to undupe as well\n"); 68 | return 1; 69 | } 70 | 71 | strlcpy(dupefile, dupepath, 1024); 72 | strlcpy(dupename, argv[1], 1024); 73 | sprintf(data2, "%s/dupefile.%d", storage, (int)getuid()); 74 | 75 | if (!(fp = fopen(dupefile, "r+b"))) { 76 | printf("FATAL ERROR: Unable to open dupefile (%s)\n", dupefile); 77 | return 1; 78 | } 79 | if (!(fp2 = fopen(data2, "w+b"))) { 80 | printf("FATAL ERROR: Unable to write to tempfile (%s)\n", data2); 81 | fclose(fp); 82 | return 1; 83 | } 84 | 85 | while (!feof(fp)) { 86 | if (fread(&buffer, sizeof(struct dupeentry), 1, fp) < 1) 87 | break; 88 | /* If we found the file, delete it */ 89 | if (strcmp(buffer.filename, dupename) == 0) 90 | fflush(fp); 91 | /* if not, write it to the new file, if we can */ 92 | else if (fwrite(&buffer, sizeof(struct dupeentry), 1, fp2) < 1) 93 | break; 94 | } 95 | 96 | fclose(fp); 97 | fclose(fp2); 98 | 99 | /* 100 | * Time to put back the remainder of the dupefile. We try renaming the 101 | * tempfile first, if this fails we try streaming the contents of the 102 | * tempfile to the original file. Streaming will work where renaming 103 | * fails if the directory is not writable for the user. 104 | */ 105 | 106 | if (rename(data2, dupefile) == -1) { 107 | if (!(fp = fopen(data2, "r+b"))) { 108 | printf("FATAL ERROR: Unable to open tempfile (%s)\n", data2); 109 | return 1; 110 | } 111 | if (!(fp2 = fopen(dupefile, "w+b"))) { 112 | printf("FATAL ERROR: Unable to write to dupefile (%s)\n", dupefile); 113 | fclose(fp); 114 | return 1; 115 | } 116 | 117 | while (!feof(fp)) { 118 | if (fread(&buffer, sizeof(struct dupeentry), 1, fp) < 1) 119 | break; 120 | if (fwrite(&buffer, sizeof(struct dupeentry), 1, fp2) < 1) 121 | break; 122 | } 123 | 124 | fclose(fp); 125 | fclose(fp2); 126 | 127 | if (chmod(dupefile, 0666)) 128 | printf("WARNING: Failed to chmod %s: %s\n", dupefile, strerror(errno)); 129 | 130 | if (unlink(data2) > 0) { 131 | printf("FATAL ERROR: Unable to delete tempfile (%s)\n", data2); 132 | return 1; 133 | } 134 | } 135 | 136 | return 0; 137 | } 138 | -------------------------------------------------------------------------------- /zipscript/src/racestats.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | 10 | #include "zsfunctions.h" 11 | #include "race-file.h" 12 | #include "objects.h" 13 | #include "macros.h" 14 | #include "convert.h" 15 | #include "dizreader.h" 16 | #include "stats.h" 17 | 18 | #include "../conf/zsconfig.h" 19 | #include "../include/zsconfig.defaults.h" 20 | 21 | int 22 | main(int argc, char **argv) 23 | { 24 | int n=0; 25 | GLOBAL g; 26 | 27 | if (argc == 1) { 28 | printf("Usage: %s \n", argv[0]); 29 | exit(EXIT_SUCCESS); 30 | } 31 | 32 | g.l.race = malloc(PATH_MAX); 33 | g.l.sfv = malloc(PATH_MAX); 34 | 35 | g.ui = malloc(sizeof(struct USERINFO *) * 30); 36 | memset(g.ui, 0, sizeof(struct USERINFO *) * 30); 37 | g.gi = malloc(sizeof(struct GROUPINFO *) * 30); 38 | memset(g.gi, 0, sizeof(struct GROUPINFO *) * 30); 39 | 40 | g.v.misc.slowest_user[0] = ULONG_MAX; 41 | g.v.misc.fastest_user[0] = 42 | g.v.total.speed = 43 | g.v.total.files_missing = 44 | g.v.total.files = 45 | g.v.total.size = 46 | g.v.total.users = 47 | g.v.total.groups = 0; 48 | 49 | g.v.file.name[0] = '.'; 50 | g.v.file.name[1] = 0; 51 | 52 | strcpy(g.l.path, argv[1]); 53 | 54 | n = strlen(g.l.path); 55 | if (g.l.path[n] == '/') { 56 | g.l.path[n] = 0; 57 | } 58 | if (chdir(g.l.path)) 59 | goto END; 60 | 61 | getrelname(&g); 62 | 63 | sprintf(g.l.race, storage "/%s/racedata", argv[1]); 64 | if (!fileexists(g.l.race)) 65 | goto END; 66 | 67 | readrace(g.l.race, &g.v, g.ui, g.gi); 68 | sprintf(g.l.sfv, storage "/%s/sfvdata", argv[1]); 69 | 70 | if (!fileexists(g.l.sfv)) { 71 | if (fileexists(g.l.sfv)) { 72 | // g.v.total.files = read_diz("file_id.diz"); 73 | g.v.total.files = read_diz(); 74 | g.v.total.files_missing += g.v.total.files; 75 | } else { 76 | g.v.total.files -= g.v.total.files_missing; 77 | g.v.total.files_missing = 0; 78 | } 79 | } else { 80 | readsfv(g.l.path, &g.v, 0); 81 | } 82 | 83 | sortstats(&g.v, g.ui, g.gi); 84 | if (!g.v.total.users) 85 | goto END; 86 | 87 | printf("%s\n", convert(&g.v, g.ui, g.gi, stats_line)); 88 | 89 | END: 90 | free(g.l.race); 91 | free(g.l.sfv); 92 | free(g.gi); 93 | free(g.ui); 94 | 95 | exit(EXIT_SUCCESS); 96 | } 97 | -------------------------------------------------------------------------------- /zipscript/src/scandir.c: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * * 3 | * Viewmol * 4 | * * 5 | * S C A N D I R . C * 6 | * * 7 | * Copyright (c) Joerg-R. Hill, December 2000 * 8 | * * 9 | ******************************************************************************** 10 | * 11 | * $Id: scandir.c,v 1.2 2000/12/10 15:37:02 jrh Exp $ 12 | * $Log: scandir.c,v $ 13 | * Revision 1.2 2000/12/10 15:37:02 jrh 14 | * Release 2.3 15 | * 16 | * Revision 1.1 1999/05/24 01:29:43 jrh 17 | * Initial revision 18 | * 19 | */ 20 | #include 21 | #include 22 | #include 23 | #include 24 | 25 | /* This function is only required for SunOS, all other supported OS 26 | have this function in their system library */ 27 | 28 | int scandir(const char *dir, struct dirent ***namelist, 29 | int (*select)(const struct dirent *), 30 | int (*compar)(const struct dirent **, const struct dirent **)) 31 | { 32 | DIR *d; 33 | struct dirent *entry; 34 | register int i=0; 35 | size_t entrysize; 36 | 37 | if ((d=opendir(dir)) == NULL) 38 | return(-1); 39 | 40 | *namelist=NULL; 41 | while ((entry=readdir(d)) != NULL) 42 | { 43 | if (select == NULL || (select != NULL && (*select)(entry))) 44 | { 45 | *namelist=(struct dirent **)realloc((void *)(*namelist), 46 | (size_t)((i+1)*sizeof(struct dirent *))); 47 | if (*namelist == NULL) return(-1); 48 | entrysize=sizeof(struct dirent)-sizeof(entry->d_name)+(int)strlen(entry->d_name)+1; 49 | (*namelist)[i]=(struct dirent *)malloc(entrysize); 50 | if ((*namelist)[i] == NULL) return(-1); 51 | memcpy((*namelist)[i], entry, entrysize); 52 | i++; 53 | } 54 | } 55 | if (closedir(d)) return(-1); 56 | if (i == 0) return(-1); 57 | if (compar != NULL) 58 | qsort((void *)(*namelist), (size_t)i, sizeof(struct dirent *), compar); 59 | 60 | return(i); 61 | } 62 | 63 | int alphasort(const struct dirent **a, const struct dirent **b) 64 | { 65 | return(strcmp((*a)->d_name, (*b)->d_name)); 66 | } 67 | -------------------------------------------------------------------------------- /zipscript/src/strsep.c: -------------------------------------------------------------------------------- 1 | /*- 2 | * Copyright (c) 1990, 1993 3 | * The Regents of the University of California. All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 1. Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright 11 | * notice, this list of conditions and the following disclaimer in the 12 | * documentation and/or other materials provided with the distribution. 13 | * 3. All advertising materials mentioning features or use of this software 14 | * must display the following acknowledgement: 15 | * This product includes software developed by the University of 16 | * California, Berkeley and its contributors. 17 | * 4. Neither the name of the University nor the names of its contributors 18 | * may be used to endorse or promote products derived from this software 19 | * without specific prior written permission. 20 | * 21 | * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 22 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 25 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 26 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 27 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 28 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 29 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 30 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 31 | * SUCH DAMAGE. 32 | */ 33 | 34 | #if defined(LIBC_SCCS) && !defined(lint) 35 | static char sccsid[] = "@(#)strsep.c 8.1 (Berkeley) 6/4/93"; 36 | #endif /* LIBC_SCCS and not lint */ 37 | //#include 38 | //__FBSDID("$FreeBSD: src/lib/libc/string/strsep.c,v 1.5 2002/03/21 18:44:54 obrien Exp $"); 39 | 40 | #include 41 | #include 42 | 43 | /* 44 | * Get next token from string *stringp, where tokens are possibly-empty 45 | * strings separated by characters from delim. 46 | * 47 | * Writes NULs into the string at *stringp to end tokens. 48 | * delim need not remain constant from call to call. 49 | * On return, *stringp points past the last NUL written (if there might 50 | * be further tokens), or is NULL (if there are definitely no more tokens). 51 | * 52 | * If *stringp is NULL, strsep returns NULL. 53 | */ 54 | char * 55 | strsep(stringp, delim) 56 | char **stringp; 57 | const char *delim; 58 | { 59 | char *s; 60 | const char *spanp; 61 | int c, sc; 62 | char *tok; 63 | 64 | if ((s = *stringp) == NULL) 65 | return (NULL); 66 | for (tok = s;;) { 67 | c = *s++; 68 | spanp = delim; 69 | do { 70 | if ((sc = *spanp++) == c) { 71 | if (c == 0) 72 | s = NULL; 73 | else 74 | s[-1] = 0; 75 | *stringp = s; 76 | return (tok); 77 | } 78 | } while (sc != 0); 79 | } 80 | /* NOTREACHED */ 81 | } 82 | -------------------------------------------------------------------------------- /zipscript/utils/Makefile.in: -------------------------------------------------------------------------------- 1 | CC=@CC@ 2 | MAKE=@MAKE@ 3 | 4 | CFLAGS=@CFLAGS@ -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE @DEFS@ -W -Wall -Wundef -Wshadow -Wpointer-arith -Wcast-align -Wstrict-prototypes -Wmissing-prototypes -Wnested-externs -Winline -I../include/ -I../../ 5 | 6 | all: racedatatest sfvdatatest headdatatest 7 | 8 | racedatatest: racedatatest.c 9 | $(CC) $(CFLAGS) racedatatest.c -o $@ 10 | 11 | sfvdatatest: sfvdatatest.c 12 | $(CC) $(CFLAGS) sfvdatatest.c -o $@ 13 | 14 | headdatatest: headdatatest.c 15 | $(CC) $(CFLAGS) headdatatest.c -o $@ 16 | -------------------------------------------------------------------------------- /zipscript/utils/headdatatest.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | #include "race-file.h" 7 | 8 | int main(int argc, char **argv) 9 | { 10 | HEADDATA sd; 11 | FILE *f; 12 | 13 | if (argc != 2) { 14 | fprintf(stderr, "Usage: %s \n", argv[0]); 15 | return EXIT_FAILURE; 16 | } 17 | 18 | if (!(f = fopen(argv[1], "r"))) { 19 | perror("fopen"); 20 | return EXIT_FAILURE; 21 | } 22 | 23 | 24 | fread(&sd, sizeof(HEADDATA), 1, f); 25 | printf("data version : %d\n", sd.data_version); 26 | printf("release type : %d\n", sd.data_type); 27 | printf("locked : %d\n", sd.data_in_use); 28 | printf("data inc. : %d\n", sd.data_incrementor); 29 | printf("queue : %d/%d\n", sd.data_qcurrent, sd.data_queue); 30 | printf("process pid : %d\n", sd.data_pid); 31 | printf("completed flag: %d\n", sd.data_completed); 32 | 33 | fclose(f); 34 | 35 | return EXIT_SUCCESS; 36 | } 37 | -------------------------------------------------------------------------------- /zipscript/utils/racedatatest.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | #include "race-file.h" 7 | 8 | int main(int argc, char **argv) 9 | { 10 | RACEDATA rd; 11 | FILE *f; 12 | 13 | if (argc != 2) { 14 | fprintf(stderr, "Usage: %s \n", argv[0]); 15 | return EXIT_FAILURE; 16 | } 17 | 18 | if (!(f = fopen(argv[1], "r"))) { 19 | perror("fopen"); 20 | return EXIT_FAILURE; 21 | } 22 | 23 | while ((fread(&rd, sizeof(RACEDATA), 1, f))) { 24 | printf("File: %s\n", rd.fname); 25 | printf("CRC32: %.8x\n", rd.crc32); 26 | printf("Size: %llu\n", rd.size); 27 | printf("Time: %i\n", (int)rd.start_time); 28 | printf("Status: %u\n", rd.status); 29 | printf("Uname: %s\n", rd.uname); 30 | printf("Group: %s\n\n", rd.group); 31 | } 32 | 33 | fclose(f); 34 | 35 | return EXIT_SUCCESS; 36 | } 37 | -------------------------------------------------------------------------------- /zipscript/utils/sfvdatatest.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | #include "race-file.h" 7 | 8 | int main(int argc, char **argv) 9 | { 10 | SFVDATA sd; 11 | FILE *f; 12 | 13 | if (argc != 2) { 14 | fprintf(stderr, "Usage: %s \n", argv[0]); 15 | return EXIT_FAILURE; 16 | } 17 | 18 | if (!(f = fopen(argv[1], "r"))) { 19 | perror("fopen"); 20 | return EXIT_FAILURE; 21 | } 22 | 23 | while ((fread(&sd, sizeof(SFVDATA), 1, f))) { 24 | printf("%s %.8x\n", sd.fname, sd.crc32); 25 | } 26 | 27 | fclose(f); 28 | 29 | return EXIT_SUCCESS; 30 | } 31 | --------------------------------------------------------------------------------