summarylogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.SRCINFO8
-rw-r--r--PKGBUILD15
-rwxr-xr-xbuildandcopy.sh26
-rw-r--r--obfuscate.c132
4 files changed, 38 insertions, 143 deletions
diff --git a/.SRCINFO b/.SRCINFO
index c7b40c7be6d2..8f24237b85f6 100644
--- a/.SRCINFO
+++ b/.SRCINFO
@@ -1,14 +1,14 @@
pkgbase = cisco-encrypt
pkgdesc = Password encoder for Cisco VPN client
pkgver = 1.0
- pkgrel = 1
- url = http://staff.science.uva.nl/~bakkerr/obfuscate.c
+ pkgrel = 2
+ url = https://github.com/coldfix/cisco-encrypt.git
arch = x86_64
arch = i686
license = GPL2
depends = libgcrypt>=1.1.90
- source = http://staff.science.uva.nl/~bakkerr/obfuscate.c
- sha256sums = b19f9cc58c11e9543d4b2021ffec683d8e3995f545399e9dd89059950f479f75
+ source = cisco-encrypt::git+https://github.com/coldfix/cisco-encrypt.git
+ sha256sums = SKIP
pkgname = cisco-encrypt
diff --git a/PKGBUILD b/PKGBUILD
index 76ad3943263e..ba4b5d9baf37 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -3,20 +3,21 @@
pkgname=cisco-encrypt
pkgver=1.0
-pkgrel=1
+pkgrel=2
pkgdesc='Password encoder for Cisco VPN client'
-url='http://staff.science.uva.nl/~bakkerr/obfuscate.c'
+url='https://github.com/coldfix/cisco-encrypt.git'
arch=('x86_64' 'i686')
license=('GPL2')
depends=('libgcrypt>=1.1.90')
-source=('http://staff.science.uva.nl/~bakkerr/obfuscate.c')
-sha256sums=('b19f9cc58c11e9543d4b2021ffec683d8e3995f545399e9dd89059950f479f75')
+source=($pkgname::git+https://github.com/coldfix/cisco-encrypt.git)
+sha256sums=('SKIP')
build() {
- cd "${srcdir}"
- gcc -Wall -o "${pkgname}" obfuscate.c $(libgcrypt-config --libs --cflags)
+ cd "$srcdir/$pkgname"
+ gcc -Wall -o "${pkgname}" cisco-encrypt.c $(libgcrypt-config --libs --cflags)
}
package() {
- install -Dm755 "${srcdir}/${pkgname}" "${pkgdir}/usr/bin/${pkgname}"
+ cd "$srcdir/$pkgname"
+ install -Dm755 "$pkgname" "$pkgdir/usr/bin/$pkgname"
}
diff --git a/buildandcopy.sh b/buildandcopy.sh
new file mode 100755
index 000000000000..575021862798
--- /dev/null
+++ b/buildandcopy.sh
@@ -0,0 +1,26 @@
+#!/bin/sh
+
+thedirs="."
+repodir=/home/own-repo
+
+thingsToDo=(
+ 'for n in $thedirs; do ( cd $n && updpkgsums); done'
+ 'for n in $thedirs; do ( cd $n && makepkg --force --nodeps --nobuild; makepkg --printsrcinfo > .SRCINFO ); done'
+ 'git diff --quiet --no-ext-diff --exit-code && echo clean || ( git diff -b -w && git add -p && git commit ) || true'
+ 'for n in $thedirs; do ( cd $n && makepkg --force --nodeps --noextract --cleanbuild --skipchecksums); done'
+ 'git push origin'
+ 'for n in $thedirs; do ( cd $n && makepkg --nodeps --noextract --force --nobuild --noarchive --nocheck --noprepare --skipinteg --clean ); done'
+)
+
+set -e
+
+for n in "${thingsToDo[@]}"; do
+ echo "Continue with [$n] (y*|n)?"
+ read v
+ if [ "$v" = "n" -o "$v" = "N" ]; then
+ echo "..command skipped..";
+ else
+ eval "$n";
+ fi
+done
+
diff --git a/obfuscate.c b/obfuscate.c
deleted file mode 100644
index 4cd6904aa0b9..000000000000
--- a/obfuscate.c
+++ /dev/null
@@ -1,132 +0,0 @@
-/* Password encoder for Cisco VPN client.
- Copyright (C) 2009 Sebastian Wicki
-
- Derivated from cisco-decrypt - Copyright (C) 2005 Maurice Massar
- Thanks to HAL-9000@evilscientists.de for decoding and posting the algorithm!
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-*/
-
-/*
- Requires libgcrypt version 1.1.90 or newer
- Compile with:
- gcc -Wall -o cisco-encrypt cisco-encrypt.c $(libgcrypt-config --libs --cflags)
- Usage:
- ./cisco-encrypt PASSWORD1 PASSWORD2 ...
-*/
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <gcrypt.h>
-#include <errno.h>
-#include <time.h>
-
-void printhex(unsigned char *buffer, int length) {
- int i;
- for(i=0; i<length; i++) {
- printf("%02X", buffer[i]);
- }
- printf("\n");
-}
-
-int c_encrypt(const char *pw, int pwlen, char **resp, int *reslenp) {
- char ht[20], h1[20], h2[20], h3[20], h4[20], key[24];
- const char *iv = h1;
- char *res, *enc, *tmp;
- int i, enclen = (pwlen%8) ? ((pwlen/8)+1)*8 : pwlen;
-
- gcry_cipher_hd_t ctx;
- time_t rawtime;
-
- time(&rawtime);
- tmp = ctime(&rawtime);
-
- /* h1 = SHA1 of ctime - bad source for entropy */
- gcry_md_hash_buffer(GCRY_MD_SHA1, h1, tmp, strlen(tmp));
-
- /* ht = temporary hash */
- memcpy(ht, h1, 20);
-
- /* h2 = SHA1 of modified h1*/
- ht[19]++;
- gcry_md_hash_buffer(GCRY_MD_SHA1, h2, ht, 20);
-
- /* h3 = SHA1 of modified h2 */
- ht[19] += 2;
- gcry_md_hash_buffer(GCRY_MD_SHA1, h3, ht, 20);
-
- /* key = h2 + (4 bytes of h3) */
- memcpy(key, h2, 20);
- memcpy(key+20, h3, 4);
-
- /* allocate buffer for in-place encryption */
- enc = malloc(enclen);
- if(enc == NULL) {
- return -1;
- }
-
- memcpy(enc, pw, pwlen);
-
- /* padding */
- for(i=pwlen; i<enclen; i++) {
- enc[i] = enclen - pwlen;
- }
-
- /* encrypt password with 3DES with iv = 8 bytes of h1, key = see above */
- gcry_cipher_open(&ctx, GCRY_CIPHER_3DES, GCRY_CIPHER_MODE_CBC, 0);
- gcry_cipher_setkey(ctx, key, 24);
- gcry_cipher_setiv(ctx, iv, 8);
- gcry_cipher_encrypt(ctx, (unsigned char *)enc, enclen, NULL, 0);
- gcry_cipher_close(ctx);
-
- /* h4 = SHA1 of encrypted password */
- gcry_md_hash_buffer(GCRY_MD_SHA1, h4, enc, enclen);
-
- /* hash length */
- *reslenp = enclen+40;
- res = malloc(*reslenp);
-
- /* hash = h1 | h4 | encrypted password */
- memcpy(res, h1, 20);
- memcpy(res+20, h4, 20);
- memcpy(res+40, enc, enclen);
-
- *resp = res;
-
- free(enc);
- return 0;
-}
-
-int main(int argc, char *argv[]) {
- int i, ret = 0, pwlen, hashlen;
- char *hash;
-
- gcry_check_version(NULL);
-
- for (i = 1; i < argc; i++) {
- pwlen = strlen(argv[i])+1;
-
- ret = c_encrypt(argv[i], pwlen, &hash, &hashlen);
- if(ret != 0) {
- perror("encodig failed");
- continue;
- }
-
- printhex((unsigned char *)hash, hashlen);
- free(hash);
- }
- exit(ret != 0);
-}
-