/relevation/trunk-1981/debian |
---|
File deleted |
\ No newline at end of file |
Property changes: |
Deleted: svn:special |
-* |
\ No newline at end of property |
/relevation/trunk-1981/CHANGELOG |
---|
1,4 → 1,14 |
0.2.0 (2011-06-27) (unreleased) |
0.3.0 (2011-06-28) (unreleased) |
- Tarball preparation code |
- Configuration file support |
- Manpage SGML cleanup |
- Document configuration file |
- License as BSD (2 clause) |
- Allow filtering by type (or by not-type) |
- Don't dump XML by default, re-format entries instead |
- Add --xml to dump XML explicitly |
0.2.0 (2011-06-27) (internal) |
- Allow multiple queries in one run |
- Consider positional arguments as queries |
- Feedback enhancements |
/relevation/trunk-1981/relevation.1 |
---|
3,43 → 3,43 |
relevation \(em command-line searcher for \fBRevelation\fP files |
.SH "SYNOPSIS" |
.PP |
\fBrelevation\fR\fB \-f \fI/path/to/file.\fR\fP\fB \-p \fIpassword\fR\fP [\fBsearch string\fP] |
\fBrelevation\fR [\fBoptions\fP] [\fIsearch string\fR [\fI...\fR] ] |
.SH "DESCRIPTION" |
.PP |
Access and print or search passwords in a \fBRevelation\fP password |
file. |
Access and print or search passwords in a \fBRevelation\fP password file. |
.PP |
Only read access is provided, to edit the files \fBRevelation\fP must be used. |
.PP |
With a search string, only entries that match the search string in any |
of its fields will be printed. |
With a search string, only entries that match the search string in any of its fields will be printed. |
.PP |
When no search string is provided the whole, unencrypted, XML file will be |
printed. |
When no search string is provided the whole list of entries will be printed. |
.SH "OPTIONS" |
.PP |
This program follows the usual command line syntax, |
with long options starting with two dashes (`\-'). A summary of |
options is included below. For a complete description, see the |
\fBInfo\fP files. |
This program follows the usual GNU command line syntax, with long options starting with two dashes (`\-'). A summary of options is included below. |
.IP "\fB-f \fIfile.revelation\fR\fP, \fB\-\-file=\fIfile.revelation\fR\fP " 10 |
File name of the \fBrevelation\fR file (the file |
containing the list of stored credentials). |
File name of the \fBrevelation\fR file (the file containing the list of stored credentials). |
.IP "\fB-p \fIpassword\fR\fP, \fB\-\-password=\fIpassword\fR\fP " 10 |
Decryption password. |
.IP "\fB-a\fP, \fB\-\-ask, \fB-0\fP, \fB\-\-stdin\fP\fP " 10 |
.IP "\fB-a\fP, \fB\-\-ask\fP, \fB-0\fP, \fB\-\-stdin\fP " 10 |
Ask interactively for password. |
.IP "" 10 |
When \fB-a\fP or \fB\-\-ask\fP is used a prompt will be printed. |
.IP "" 10 |
Use either one of this variants or \fB\-\-password\fP. |
.IP "\fB-t \fItype\fR\fP, \fB\-\-type=\fItype\fR\fP" 10 |
Print only entries of a certain type. |
.IP "" 10 |
Known types: creditcard, cryptokey, database, door, email, folder, ftp, generic, phone, shell, website. |
.IP "" 10 |
If preceded by a slash it will be negated, i.e. `\-website' will select entries that are not of type website. |
.IP "" 10 |
When searching for a string, folders are skipped (equivalent to `\-\-type=\-folder'). |
.IP "\fB-i\fP, \fB\-\-case-insensitive\fP " 10 |
When searching for text, disregard case. |
.IP "" 10 |
This is the default behaviour. |
.IP "" 10 |
If the search string contains special/non-English characters this is |
likely to fail. |
If the search string contains special/non-English characters this is likely to fail. |
.IP "\fB-c\fP, \fB\-\-case-sensitive\fP " 10 |
When searching for text, obey case. |
.IP "\fB-s \fIsearch string\fR\fP, \fB\-\-search=\fIsearch string\fR\fP, \fB\fIsearch string\fR\fP " 10 |
47,15 → 47,29 |
.IP "\fB-h\fP, \fB\-\-help\fP " 10 |
Show summary of options. |
.IP "\fB\-\-version\fP " 10 |
Show version of program. |
Show version information for relevation. |
.SH "CONFIGURATION FILE" |
.PP |
A configuration file `.relevation.conf' located at the user's home directory can be used to avoid having to provide the filename and/or password on each run. |
.PP |
Example `~/.relevation.conf': |
.PP |
.nf |
\ [relevation] |
\ file=~/passwords.revelation |
\ password=my secret password |
.fi |
.PP |
.PP |
Both file and password are optional, so you can store the filename without storing the password. |
.PP |
Please understand your password is stored in this file in clear text, modify the file permissions appropriately so that only your user can read it, otherwise your master password might be compromised and hence all your stored password will be too. |
.SH "SEE ALSO" |
.PP |
revelation (1) |
.SH "AUTHOR" |
.PP |
This manual page was written by Toni Corvera outlyer@gmail.com. |
Permission is |
granted to copy, distribute and/or modify this document under |
the terms of a BSD 3-clause license. |
This manual page was written by Toni Corvera <outlyer@gmail.com>. |
Permission is granted to copy, distribute and/or modify this document under the terms of a BSD 2-clause license. |
.\" created by instant / docbook-to-man, Mon 27 Jun 2011, 04:51 |
.\" created by instant / docbook-to-man, Tue 28 Jun 2011, 02:45 |
/relevation/trunk-1981/manpage.sgml |
---|
12,18 → 12,16 |
docbook-to-man $< > $@ |
--> |
<!-- Fill in your name for FIRSTNAME and SURNAME. --> |
<!ENTITY dhfirstname "<firstname>Toni</firstname>"> |
<!ENTITY dhsurname "<surname>Corvera</surname>"> |
<!-- Please adjust the date whenever revising the manpage. --> |
<!ENTITY dhdate "<date>June 27, 2011</date>"> |
<!-- SECTION should be 1-8, maybe w/ subsection other parameters are |
allowed: see man(7), man(1). --> |
<!ENTITY dhdate "<date>June 28, 2011</date>"> |
<!ENTITY dhsection "<manvolnum>1</manvolnum>"> |
<!ENTITY dhemail "<email>outlyer@gmail.com</email>"> |
<!ENTITY dhusername "Toni Corvera"> |
<!ENTITY dhucpackage "<refentrytitle>RELEVATION</refentrytitle>"> |
<!ENTITY dhpackage "relevation"> |
<!ENTITY gnu "<acronym>GNU</acronym>"> |
]> |
<refentry> |
36,7 → 34,7 |
&dhsurname; |
</author> |
<copyright> |
<year>2003</year> |
<year>2011</year> |
<holder>&dhusername;</holder> |
</copyright> |
&dhdate; |
54,36 → 52,26 |
<refsynopsisdiv> |
<cmdsynopsis> |
<command>&dhpackage;</command> |
<option> -f <replaceable>/path/to/file.</replaceable></option> |
<option> -p <replaceable>password</replaceable></option> |
<arg><option>search string</option></arg> |
<arg choice="opt"><option>options</option></arg> |
<arg choice="opt"><replaceable>search string</replaceable> <arg choice="opt"><replaceable>...</replaceable></arg></arg> |
</cmdsynopsis> |
</refsynopsisdiv> |
<refsect1> |
<title>DESCRIPTION</title> |
<para>Access and print or search passwords in a <application>Revelation</application> password |
file.</para> |
<para>Access and print or search passwords in a <application>Revelation</application> password file.</para> |
<para>Only read access is provided, to edit the files <application>Revelation</application> |
must be used.</para> |
<para>Only read access is provided, to edit the files <application>Revelation</application> must be used.</para> |
<para>With a search string, only entries that match the search string in any |
of its fields will be printed.</para> |
<para>With a search string, only entries that match the search string in any of its fields will be printed.</para> |
<para>When no search string is provided the whole, unencrypted, XML file will be |
printed.</para> |
<para>When no search string is provided the whole list of entries will be printed.</para> |
</refsect1> |
<refsect1> |
<title>OPTIONS</title> |
<para>This program follows the usual &gnu; command line syntax, |
with long options starting with two dashes (`-'). A summary of |
options is included below. For a complete description, see the |
<application>Info</application> files.</para> |
<para>This program follows the usual &gnu; command line syntax, with long options starting with two dashes (`-'). A summary of options is included below.</para> |
<variablelist> |
<varlistentry> |
90,8 → 78,7 |
<term><option>-f <replaceable>file.revelation</replaceable></option>, <option>--file=<replaceable>file.revelation</replaceable></option> |
</term> |
<listitem> |
<para>File name of the <command>revelation</command> file (the file |
containing the list of stored credentials).</para> |
<para>File name of the <command>revelation</command> file (the file containing the list of stored credentials).</para> |
</listitem> |
</varlistentry> |
<varlistentry> |
102,7 → 89,7 |
</listitem> |
</varlistentry> |
<varlistentry> |
<term><option>-a</option>, <option>--ask, <option>-0</option>, <option>--stdin</option></option> |
<term><option>-a</option>, <option>--ask</option>, <option>-0</option>, <option>--stdin</option> |
</term> |
<listitem> |
<para>Ask interactively for password.</para> |
111,13 → 98,21 |
</listitem> |
</varlistentry> |
<varlistentry> |
<term><option>-t <replaceable>type</replaceable></option>, <option>--type=<replaceable>type</replaceable></option></term> |
<listitem> |
<para>Print only entries of a certain type.</para> |
<para>Known types: creditcard, cryptokey, database, door, email, folder, ftp, generic, phone, shell, website.</para> |
<para>If preceded by a slash it will be negated, i.e. `-website' will select entries that are not of type website.</para> |
<para>When searching for a string, folders are skipped (equivalent to `--type=-folder').</para> |
</listitem> |
</varlistentry> |
<varlistentry> |
<term><option>-i</option>, <option>--case-insensitive</option> |
</term> |
<listitem> |
<para>When searching for text, disregard case.</para> |
<para>This is the default behaviour.</para> |
<para>If the search string contains special/non-English characters this is |
likely to fail.</para> |
<para>If the search string contains special/non-English characters this is likely to fail.</para> |
</listitem> |
</varlistentry> |
<varlistentry> |
146,12 → 141,23 |
<term><option>--version</option> |
</term> |
<listitem> |
<para>Show version of program.</para> |
<para>Show version information for &dhpackage;.</para> |
</listitem> |
</varlistentry> |
</variablelist> |
</refsect1> |
<refsect1> |
<title>CONFIGURATION FILE</title> |
<para>A configuration file `.relevation.conf' located at the user's home directory can be used to avoid having to provide the filename and/or password on each run.</para> |
<para>Example `~/.relevation.conf':</para> |
<programlisting> [relevation] |
file=~/passwords.revelation |
password=my secret password</programlisting> |
<para>Both file and password are optional, so you can store the filename without storing the password.</para> |
<para>Please understand your password is stored in this file in clear text, modify the file permissions appropriately so that only your user can read it, otherwise your master password might be compromised and hence all your stored password will be too.</para> |
</refsect1> |
<refsect1> |
<title>SEE ALSO</title> |
<para>revelation (1)</para> |
159,27 → 165,9 |
<refsect1> |
<title>AUTHOR</title> |
<para>This manual page was written by &dhusername; &dhemail;. |
Permission is |
granted to copy, distribute and/or modify this document under |
the terms of a BSD 3-clause license. |
<para>This manual page was written by &dhusername; <&dhemail;>. |
Permission is granted to copy, distribute and/or modify this document under the terms of a BSD 2-clause license. |
</para> |
</refsect1> |
</refentry> |
<!-- Keep this comment at the end of the file |
Local variables: |
mode: sgml |
sgml-omittag:t |
sgml-shorttag:t |
sgml-minimize-attributes:nil |
sgml-always-quote-attributes:t |
sgml-indent-step:2 |
sgml-indent-data:t |
sgml-parent-document:nil |
sgml-default-dtd-file:nil |
sgml-exposed-tags:nil |
sgml-local-catalogs:nil |
sgml-local-ecat-files:nil |
End: |
--> |
<!-- vim: set et: --> |
/relevation/trunk-1981/Makefile |
---|
9,8 → 9,11 |
all: $(PKG).1 |
testman: |
docbook-to-man manpage.sgml | nroff -man | less |
clean: |
-$(RM) $(PKG).pyc |
-$(RM) *.pyc *.pyo manpage.html |
install: |
install -D -m755 $(PKG).py $(DESTDIR)$(prefix)/bin/$(PKG) |
17,14 → 20,19 |
install -D -m644 $(PKG).1 $(DESTDIR)$(prefix)/share/man/man1/$(PKG).1 |
uninstall: |
-$(RM) $(DESTDIR)$(prefix)/$(PKG) |
-$(RM) $(DESTDIR)$(prefix)/$(PKG) $(DESTDIR)$(prefix)/share/man/man1/$(PKG).1 |
-rmdir --parents $(DESTDIR)$(prefix)/bin |
$(PKG).1: manpage.sgml |
docbook-to-man $< > $@ |
manpage.html: $(PKG).1 |
man2html $< | sed '1,2d' > $@ |
TAR_EXCLUDES=--exclude=debian --exclude-vcs --exclude=$(PKGVER) --exclude=*.pyo --exclude=*.pyc |
dist: clean |
# Only allowed if RELEASE |
echo -e 'import relevation\nif not relevation.RELEASE:\n\traise Exception("RELEASE is False")' | python - |
-$(RM) $(PKGVER).tar.gz |
-mkdir $(PKGVER) |
tar c . $(TAR_EXCLUDES) | ( cd $(PKGVER) && tar x ) |
/relevation/trunk-1981/relevation.py |
---|
5,9 → 5,32 |
Relevation Password Printer |
a command line interface to Revelation Password Manager. |
This program is published under a BSD 3-clause license, |
the full license text is included in a separate file. |
Copyright (c) 2011, Toni Corvera |
All rights reserved. |
Redistribution and use in source and binary forms, with or without |
modification, are permitted provided that the following conditions are |
met: |
1. Redistributions of source code must retain the above copyright |
notice, this list of conditions and the following disclaimer. |
2. 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. |
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
AND EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE |
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
POSSIBILITY OF SUCH DAMAGE. |
--------------------------------------------------------------------- |
Code based on Revelation's former BTS (no longer online, not archived?): |
(ref1) code: |
http://oss.wired-networks.net/bugzilla/attachment.cgi?id=13&action=view |
16,54 → 39,118 |
-> http://web.archive.org/http://oss.wired-networks.net/bugzilla/show_bug.cgi?id=111 |
(ref3) http://docs.python.org/library/zlib.html |
""" |
from Crypto.Cipher import AES |
import ConfigParser |
import getopt |
import libxml2 |
import os |
import stat |
import sys |
import zlib |
from Crypto.Cipher import AES |
__author__ = 'Toni Corvera' |
__date__ = '$Date$' |
__revision__ = '$Rev$' |
__version_info__ = ( 0, 2, 0 ) |
__version_info__ = ( 0, 3, 0 ) |
__version__ = '.'.join(map(str, __version_info__)) |
RELEASE=True |
RELEASE=not True |
def usage(channel): |
' Print help message ' |
def p(s): |
channel.write(s) |
p('%s {-f passwordfile} {-p password | -0} search [search2] [...]\n' % sys.argv[0]) |
p('%s {-f passwordfile} {-p password | -0} [search] [search2] [...]\n' % sys.argv[0]) |
p('\nOptions:\n') |
p(' -f <FILE>, --file=<FILE> Revelation password file\n') |
p(' -p <PASS>, --password=<PASS> Master password\n') |
p(' -s <SEARCH>, --search=<SEARCH> Search for string\n') |
p(' -i, --case-insensitive Case insensitive search [default]\n') |
p(' -c, --case-sensitive Case sensitive search\n') |
p(' -f FILE, --file=FILE Revelation password file.\n') |
p(' -p PASS, --password=PASS Master password.\n') |
p(' -s SEARCH, --search=SEARCH Search for string.\n') |
p(' -i, --case-insensitive Case insensitive search (default).\n') |
p(' -c, --case-sensitive Case sensitive search.\n') |
p(' -a, --ask Interactively ask for password.\n') |
p(' Note it will be displayed in clear as you\n') |
p(' type it.\n') |
p(' -0, --stdin Read password from standard input\n') |
p(' -t TYPE, --type=TYPE Print only entries of type TYPE.\n') |
p(' With no search string, prints all entries of\n') |
p(' type TYPE.\n') |
p(' -x, --xml Dump unencrypted XML document.\n') |
p(' -0, --stdin Read password from standard input.\n') |
p(' -h, --help Print help (this message).\n') |
p(' --version Print the program\'s version information.\n') |
p('\n') |
def search(xmldata, search, caseInsensitive=True): |
def get_entries(document, xpath): |
""" |
get_entries(xmlDoc, str xpath expression) -> list of xmlNode's |
Get entry nodes that match xpath |
""" |
ctx = document.xpathNewContext() |
try: |
res = ctx.xpathEval(xpath) |
except libxml2.xpathError: |
if not RELEASE: |
sys.stderr.write('Failed with xpath expression: %s\n' % xpath) |
raise |
finally: |
ctx.xpathFreeContext() |
return res |
def make_xpath_query(search_text=None, type_filter=None, ignore_case=True, negate_filter=False): |
''' |
make_xpath_query(str, str, bool, bool) -> str |
''' |
xpath = '/revelationdata//entry' |
if type_filter: |
sign = '=' |
if negate_filter: |
sign = '!=' |
xpath = '%s[@type%s"%s"]' % ( xpath, sign, type_filter ) |
if search_text: |
xpath = xpath + '//text()' |
if ignore_case: |
xpath = '%s[contains(translate(., "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "abcdefghijklmnopqrstuvwxyz"), "%s")]/../..' % ( xpath, search_text ) |
else: |
xpath = '%s[contains(., "%s")]/../..' % ( xpath, search_text ) |
return xpath |
def dump_all_entries(xmldata): |
' Dump all entries from xmldata, with no filter at all ' |
doc = libxml2.parseDoc(xmldata) |
ctxt = doc.xpathNewContext() |
commonXPath = '//revelationdata//entry[@type!="folder"]//text()' |
caseSensitiveXPath = '[contains(., "%s")]/../..' % search |
caseInsensitiveXPath = '[contains(translate(., "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "abcdefghijklmnopqrstuvwxyz"), "%s")]/../..' % search |
if caseInsensitive: |
xpath = commonXPath + caseInsensitiveXPath |
res = get_entries(doc, '//entry') |
nr = dump_result(res, 'all') |
doc.freeDoc() |
return nr |
def dump_entries(xmldata, search_text=None, type_filter=None, ignore_case=True, negate_filter=False): |
' Dump entries from xmldata that match criteria ' |
doc = libxml2.parseDoc(xmldata) |
xpath = make_xpath_query(search_text, type_filter, ignore_case, negate_filter) |
res = get_entries(doc, xpath) |
query_desc = '' |
if search_text: |
query_desc = '"%s"' % search_text |
if type_filter: |
neg = '' |
if negate_filter: |
neg = 'not ' |
if search_text: |
query_desc = '%s (\'%s%s\' entries)' % ( query_desc, neg, type_filter ) |
else: |
xpath = commonXPath + caseSensitiveXPath |
res = ctxt.xpathEval(xpath) |
print '-> Search "%s": ' % search, |
query_desc = '%s%s entries' % ( neg, type_filter ) |
nr = dump_result(res, query_desc) |
doc.freeDoc() |
return nr |
def dump_result(res, query_desc): |
''' Print query results. |
dump_result(list of entries, query description) -> int |
Note the XML document can't be freed before calling this function. |
''' |
print '-> Search %s: ' % query_desc, |
if not len(res): |
print 'No results' |
sys.exit(80) |
return False |
print '%d matches' % len(res) |
tagnames ={ 'generic-url': 'Url:', |
'generic-username': 'Username:', |
72,7 → 159,7 |
'generic-hostname': 'Hostname:', |
} |
for x in res: |
print '- * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - ' |
sys.stderr.write('-------------------------------------------------------------------------------\n') |
print '' |
for attr in x.properties: # Is it accessible directly? |
if attr.name == 'type': |
97,29 → 184,70 |
plural = '' |
if nr > 1: |
plural = 's' |
sys.stderr.write('<- (end of %d result%s for "%s")\n\n' % ( nr, plural, search )) |
doc.freeDoc() |
ctxt.xpathFreeContext() |
sys.stderr.write('-------------------------------------------------------------------------------\n') |
sys.stderr.write('<- (end of %d result%s for {%s})\n\n' % ( nr, plural, query_desc )) |
return nr |
def world_readable(path): |
' Check if a file is readable by everyone ' |
assert os.path.exists(path) |
if sys.platform == 'win32': |
return True |
st = os.stat(path) |
return bool(st.st_mode & stat.S_IROTH) |
def load_config(): |
""" |
load_config() -> ( str file, str pass ) |
Load configuration file is one is found |
""" |
cfg = os.path.join(os.path.expanduser('~'), '.relevation.conf') |
pw = None |
fl = None |
if os.path.isfile(cfg): |
if os.access(cfg, os.R_OK): |
wr = world_readable(cfg) |
if wr: |
sys.stderr.write('Configuration (~/.relevation.conf) is world-readable!!!\n') |
parser = ConfigParser.ConfigParser() |
parser.read(cfg) |
ops = parser.options('relevation') |
if 'file' in ops: |
fl = os.path.expanduser(parser.get('relevation', 'file')) |
if 'password' in ops: |
if wr and sys.platform != 'win32': # TODO: how to check in windows? |
sys.stderr.write('Your password can be read by anyone!!!\n') |
pw = parser.get('relevation', 'password') |
else: # exists but not readable |
sys.stderr.write('Configuration file (~/.relevation.conf) is not readable!\n') |
return ( fl, pw ) |
def main(): |
datafile = None |
password = None |
searches = [] |
# values to search for |
needles = [] |
caseInsensitive = True |
# individual search: ( 'value to search', 'type of search', 'type of entry to filter' ) |
searchTypes = [] |
dump_xml = False |
sys.stderr.write('Relevation v%s, (c) 2011 Toni Corvera\n\n' % __version__) |
# ---------- OPTIONS ---------- # |
( datafile, password ) = load_config() |
try: |
# gnu_getopt requires py >= 2.3 |
ops, args = getopt.gnu_getopt(sys.argv[1:], 'f:p:s:0ciah', |
ops, args = getopt.gnu_getopt(sys.argv[1:], 'f:p:s:0ciaht:x', |
[ 'file=', 'password=', 'search=', 'stdin', |
'case-sensitive', 'case-insensitive', 'ask', |
'help', 'version' ]) |
'help', 'version', 'type=', 'xml' ]) |
except getopt.GetoptError, err: |
print str(err) |
usage(sys.stderr) |
sys.exit(os.EX_USAGE) |
if args: |
searches = args |
needles = args |
if ( '-h', '' ) in ops or ( '--help', '' ) in ops: |
usage(sys.stdout) |
143,11 → 271,23 |
password = sys.stdin.readline() |
password = password[:-1] |
elif opt in ( '-s', '--search' ): |
searches.append(arg) |
needles.append(arg) |
elif opt in ( '-i', '--case-insensitive' ): |
caseInsensitive = True |
elif opt in ( '-c', '--case-sensitive' ): |
caseInsensitive = False |
elif opt in ( '-t', '--type' ): |
iarg = arg.lower() |
neg = False |
if iarg.startswith('-'): |
iarg = iarg[1:] |
neg = True |
if not iarg in ( 'creditcard', 'cryptokey', 'database', 'door', 'email', |
'folder', 'ftp', 'generic', 'phone', 'shell', 'website' ): |
sys.stderr.write('Warning: Type "%s" is not known by relevation.\n' % arg) |
searchTypes.append( ( iarg, neg ) ) |
elif opt in ( '-x', '--xml' ): |
dump_xml = True |
else: |
sys.stderr.write('Unhandled option: %s\n' % opt) |
assert False, "internal error parsing options" |
158,12 → 298,14 |
if not password: |
sys.stderr.write('Password is required\n') |
sys.exit(os.EX_USAGE) |
# Encrypted data |
# ---------- PASSWORDS FILE DECRYPTION ---------- # |
f = None |
try: |
if not os.access(datafile, os.R_OK): |
raise IOError('File \'%s\' not accessible' % datafile) |
f = open(datafile, "rb") |
# Encrypted data |
data = f.read() |
finally: |
if f: |
180,12 → 322,30 |
padlen = ord(cleardata_gz[-1]) |
# Decompress actual data (15 is wbits [ref3] DON'T CHANGE, 2**15 is the (initial) buf size) |
xmldata = zlib.decompress(cleardata_gz[:-padlen], 15, 2**15) |
if not searches: |
# ---------- QUERIES ---------- # |
if dump_xml: |
print xmldata |
sys.exit(os.EX_OK) |
for s in searches: |
search(xmldata, s, caseInsensitive) |
# Multiply values to search by type of searches |
numhits = 0 |
if not ( needles or searchTypes ): # No search nor filters, print all |
numhits = dump_all_entries(xmldata) |
elif not searchTypes: # Simple case, all searches are text searches |
for text in needles: |
numhits += dump_entries(xmldata, text, 'folder', caseInsensitive, True) |
elif needles: # Do a search filtered for each type |
for text in needles: |
for ( sfilter, negate ) in searchTypes: |
numhits += dump_entries(xmldata, text, sfilter, caseInsensitive, |
negate_filter=negate) |
else: # Do a search only of types |
for ( sfilter, negate ) in searchTypes: |
numhits += dump_entries(xmldata, None, sfilter, negate_filter=negate) |
if numhits == 0: |
sys.exit(80) |
if __name__ == '__main__': |
try: |
main() |
/relevation/trunk-1981/upstream.debian/copyright |
---|
4,34 → 4,31 |
Files: * |
Copyright: 2011 Toni Corvera <outlyer@gmail.com> |
License: BSD-3-Clause |
License: BSD-2-Clause |
Files: debian/* |
Copyright: 2011 Toni Corvera <outlyer@gmail.com> |
License: BSD-3-Clause |
License: BSD-2-Clause |
License: BSD-3-Clause |
License: BSD-2-Clause |
Redistribution and use in source and binary forms, with or without |
modification, are permitted provided that the following conditions |
are met: |
modification, are permitted provided that the following conditions are |
met: |
1. Redistributions of source code must retain the above copyright |
notice, this list of conditions and the following disclaimer. |
2. 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. |
3. Neither the name of the University nor the names of its contributors |
may be used to endorse or promote products derived from this software |
without specific prior written permission. |
. |
THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND |
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
AND EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE |
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
SUCH DAMAGE. |
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE |
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
POSSIBILITY OF SUCH DAMAGE. |
/relevation/trunk-1981/upstream.debian/manpages |
---|
0,0 → 1,0 |
relevation.1 |
/relevation/trunk-1981/upstream.debian/README.source |
---|
1,7 → 1,6 |
relevation for Debian |
--------------------- |
The upstream source includes a default set of Debian |
packaging scripts in the upstream.debian/ directory (linked |
by default as debian/ to allow direct construction of the package) |
The source includes a default set of Debian packaging scripts created |
by the origial author. |
/relevation/trunk-1981/upstream.debian/control |
---|
2,7 → 2,7 |
Section: contrib/utils |
Priority: extra |
Maintainer: Toni Corvera <outlyer@gmail.com> |
Build-Depends: debhelper (>= 7.0.50~) |
Build-Depends: debhelper (>= 7.0.50~), python (>= 2.3) |
Standards-Version: 3.9.1 |
Homepage: http://p.outlyer.net/relevation/ |
#Vcs-Git: git://git.debian.org/collab-maint/relevation.git |
/relevation/trunk-1981/upstream.debian/changelog |
---|
1,5 → 1,5 |
relevation (0.2-upstream.1) unstable; urgency=low |
relevation (0.3-upstream.1) unstable; urgency=low |
* Initial release |
-- Toni Corvera <outlyer@gmail.com> Mon, 27 Jun 2011 01:44:10 +0200 |
-- Toni Corvera <outlyer@gmail.com> Mon, 27 Jun 2011 19:34:41 +0200 |
/relevation/trunk-1981/LICENSE |
---|
1,24 → 1,24 |
Copyright (c) 2011, Toni Corvera |
All rights reserved. |
Redistribution and use in source and binary forms, with or without |
modification, are permitted provided that the following conditions |
are met: |
modification, are permitted provided that the following conditions are |
met: |
1. Redistributions of source code must retain the above copyright |
notice, this list of conditions and the following disclaimer. |
2. 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. |
3. Neither the name of the University nor the names of its contributors |
may be used to endorse or promote products derived from this software |
without specific prior written permission. |
. |
THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND |
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
AND EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE |
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
SUCH DAMAGE. |
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE |
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
POSSIBILITY OF SUCH DAMAGE. |
/relevation/trunk-1981/TODO |
---|
0,0 → 1,2 |
* Negated types *sometimes* don't really exclude the entries (they |
normally do, though) |
/relevation/trunk-1981 |
---|
Property changes: |
Modified: svn:mergeinfo |
Merged /relevation/branches/0.3:r133-138 |