Subversion Repositories pub

Compare Revisions

Ignore whitespace Rev 693 → Rev 692

/relevation/trunk/debian/changelog
1,8 → 1,8
relevation (1.3.1-pon.1) stable; urgency=medium
relevation (1.3-pon.2) stable; urgency=medium
 
* New version
* Updated build dependencies
 
-- Toni Corvera <outlyer@gmail.com> Tue, 11 Feb 2020 19:27:25 +0100
-- Toni Corvera <outlyer@gmail.com> Tue, 11 Feb 2020 13:13:46 +0100
 
relevation (1.3-pon.1) unstable; urgency=medium
 
/relevation/trunk/debian/control
2,16 → 2,16
Section: contrib/utils
Priority: extra
Maintainer: Toni Corvera <outlyer@gmail.com>
Build-Depends: debhelper (>= 7.0.50~), python3 (>= 3.7)
X-Python-Version: >= 3.7
Build-Depends: debhelper (>= 7.0.50~), python (>= 2.5)
X-Python-Version: >= 2.5
Standards-Version: 3.9.1
Homepage: https://p.outlyer.net/relevation/
Homepage: http://p.outlyer.net/relevation/
Vcs-Svn: https://svn.outlyer.net/svn/pub/relevation
Vcs-Browser: https://svn.outlyer.net/websvn/wsvn/pub/relevation/
 
Package: relevation
Architecture: all
Depends: ${shlibs:Depends}, ${misc:Depends}, python3-lxml, python3-crypto, ${python:Depends}
Depends: ${shlibs:Depends}, ${misc:Depends}, python-lxml, python-crypto, ${python:Depends}
Recommends: revelation
Description: Command-line interface to query Revelation files
This is a command-line tool capable of retrieving passwords from
/relevation/trunk/src/relevation.py
1,4 → 1,4
#!/usr/bin/env python3
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
 
"""
18,7 → 18,7
"""
# Relevation Password Printer
#
# Copyright (c) 2011,2012,2013,2014,2020 Toni Corvera
# Copyright (c) 2011,2012,2013,2014 Toni Corvera
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
42,7 → 42,7
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
 
import configparser
import ConfigParser
import getopt
import getpass
from lxml import etree
49,6 → 49,7
import locale
import os
import stat
import string
import sys
import zlib
# Help py2exe in packaging lxml
76,7 → 77,7
__author__ = 'Toni Corvera'
__date__ = '$Date$'
__revision__ = '$Rev$'
__version_info__ = ( 1, 3, 1 ) #, 0 ) # Note: For x.y.0, only x and y are kept
__version_info__ = ( 1, 3 ) #, 0 ) # Note: For x.y.0, only x and y are kept
if not RELEASE:
import traceback
__version_info__ += ( '0-pre1', )
91,7 → 92,7
codes = { 'EX_OK': 0, 'EX_USAGE': 64, 'EX_DATAERR': 65,
'EX_NOINPUT': 66, 'EX_SOFTWARE': 70, 'EX_IOERR': 74,
}
for (k,v) in list(codes.items()):
for (k,v) in codes.items():
setattr(os, k, v)
del codes, k, v
 
192,13 → 193,13
needles = search_text
else:
# FIXME: Used for OR's
assert type(search_text) == str or type(search_text) == str
assert type(search_text) == str or type(search_text) == unicode
needles = [ search_text, ]
selector = ''
for search in needles:
if ignore_case:
# must pass lowercase to actually be case insensitive
search = search.lower()
search = string.lower(search)
# XPath 2.0 has lower-case, upper-case, matches(..., -i) etc.
selector += '//text()[contains(translate(., "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "abcdefghijklmnopqrstuvwxyz"), "%s")]/../..' % search
else:
245,7 → 246,7
def dump_single_result(typeName, name, descr, notes, fields):
''' dump_single_result(str, unicode, unicode, list) -> None '''
printe('-------------------------------------------------------------------------------')
s = '\n'
s = u'\n'
s += 'Type: %s\n' % typeName
s += 'Name: %s\n' % name
s += 'Description: %s\n' % descr
254,15 → 255,12
s += '%s %s\n' % field # field, value
try:
# sys.stdout.encoding will be None if piped
#print(s.encode(sys.stdout.encoding or locale.getpreferredencoding()))
print(s)
print s.encode(sys.stdout.encoding or locale.getpreferredencoding())
except UnicodeEncodeError:
# XXX: In Python 2 there were unicode conversions, no longer needed in Python 3
# TODO: This branch shouldn't be entered anymore, but needs testing
# E.g. console in ASCII ($ LC_ALL=C relevation)
# TODO: Flag for notification
#printe("WARNING: The console doesn't have a compatible encoding, falling back to UTF-8")
print(s.encode('utf8'))
print s.encode('utf8')
 
def dump_result(res, query_desc, dumpfn=dump_single_result):
''' Print query results.
274,15 → 272,15
'''
# Note the XML is in UTF-8, and that the extracted fields will be
# either type
if type(s) == str:
if type(s) == unicode:
return s
return str(s.decode('utf8'))
return unicode(s.decode('utf8'))
 
print('-> Search %s: ' % query_desc, end=' ')
print '-> Search %s: ' % query_desc,
if not len(res):
print('No results')
print 'No results'
return False
print('%d matches' % len(res))
print '%d matches' % len(res)
for x in res:
typeName = x.get('type')
name = None
341,7 → 339,7
wr = world_readable(cfg)
if wr and sys.platform != 'win32':
printe('Configuration (~/.relevation.conf) is world-readable!!!')
parser = configparser.ConfigParser()
parser = ConfigParser.ConfigParser()
parser.read(cfg)
ops = parser.options('relevation')
if 'file' in ops:
365,9 → 363,9
''' Checks that the gzip-compressed 'data' is padded correctly.
validate_compressed_padding(str) -> bool
'''
padlen = data[-1] # XXX: While on Python 2 we were using ord(data[-1]), ord(i), etc.
padlen = ord(data[-1])
for i in data[-padlen:]:
if i != padlen:
if ord(i) != padlen:
return False
return True
def validate_cipher_length(self, data):
443,7 → 441,7
if not self.validate_compressed_padding(cleardata_gz):
raise DataFormatError
# Decompress actual data (15 is wbits [ref3] DON'T CHANGE, 2**15 is the (initial) buf size)
padlen = cleardata_gz[-1]
padlen = ord(cleardata_gz[-1])
try:
# Note data is encoded in UTF-8 but not decoded yet (because
# the XML parser is too easy to choke in that case)
490,7 → 488,7
if not self.validate_compressed_padding(cleardata_gz):
raise DataFormatError
# Decompress
padlen = cleardata_gz[-1]
padlen = ord(cleardata_gz[-1])
try:
return zlib.decompress(cleardata_gz[:-padlen])
except zlib.error:
529,13 → 527,13
'''
header = self._data[0:12]
magic = header[0:4]
if magic != b"rvl\x00":
if magic != "rvl\x00":
raise DataFormatError
data_version = header[4]
app_version = header[6:9]
if data_version == 0x01: #'\x01':
if data_version == '\x01':
self._impl = DataReaderV1()
elif data_version == 0x02: #'\x02':
elif data_version == '\x02':
self._impl = DataReaderV2()
else:
raise DataVersionError
556,7 → 554,7
dump_xml = False
mode = None
 
printe('Relevation v%s, (c) 2011-2020 Toni Corvera\n' % __version__)
printe('Relevation v%s, (c) 2011-2014 Toni Corvera\n' % __version__)
 
# ---------- OPTIONS ---------- #
( datafile, password, mode ) = load_config()
567,8 → 565,8
'case-sensitive', 'case-insensitive', 'ask',
'help', 'version', 'type=', 'xml',
'and', 'or' ])
except getopt.GetoptError as err:
print(str(err))
except getopt.GetoptError, err:
print str(err)
usage(sys.stderr)
sys.exit(os.EX_USAGE)
if args:
581,14 → 579,14
release=''
if not RELEASE:
release=' [DEBUG]'
print('Relevation version %s%s' % ( __version__, release ))
print('Python version %s' % sys.version)
print 'Relevation version %s%s' % ( __version__, release )
print 'Python version %s' % sys.version
if USE_PYCRYPTO:
import Crypto
print('PyCrypto version %s' % Crypto.__version__)
print 'PyCrypto version %s' % Crypto.__version__
else:
# AFAIK cryptopy doesn't export version info
print('cryptopy')
print 'cryptopy'
sys.exit(os.EX_OK)
for opt, arg in ops:
645,7 → 643,7
# ---------- QUERIES ---------- #
if dump_xml:
print(xmldata)
print xmldata
sys.exit(os.EX_OK)
# Multiply values to search by type of searches
numhits = 0
/relevation/trunk/CHANGELOG
1,8 → 1,5
$Date$
 
1.3.1 (2020-02-11):
- Port to Python3
 
1.3 (2014-05-24):
- Check file magic [#230] and reject unsupported data formats
- Support the new data file format [#228]
/relevation/trunk/relevation.spec.in
20,10 → 20,10
Source: http://p.outlyer.net/relevation/files/relevation-%{version}.tar.gz
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
BuildArch: noarch
BuildRequires: python3-devel, make
Requires: python3-libxml2
Requires: python3-crypto
Requires: python3-lxml
BuildRequires: python2-devel
Requires: libxml2-python
Requires: python-crypto
Requires: python-lxml
 
%description
Relevation is a tool to retrieve passwords stored in a password file in the
53,9 → 53,6
%{python2_sitelib}/relevation-*.egg-info
 
%changelog
* Tue 11 Feb 2020 Toni Corvera <outlyer@gmail.com> 1.3.1-1.pon
- Updated to use Python 3
 
* Fri May 23 2014 Toni Corvera <outlyer@gmail.com> 1.3-1.pon
- Handle installation of new module