Browse Source

Merge branch 'v0.8.1'

Oz N Tiram 8 năm trước cách đây
mục cha
commit
193bb40a6c

+ 1 - 1
.coveragerc

@@ -1,4 +1,4 @@
 [run]
-omit = pwman/tests/*.py, pwman/ui/mac.py, pwman/ui/win.py, \
+omit = pwman/tests/*.py, pwman/util/crypto/*.py, pwman/ui/mac.py, pwman/ui/win.py, \
        pwman/data/convertdb.py, \
 source = pwman

+ 1 - 0
.travis.yml

@@ -2,6 +2,7 @@ language: python
 python:
   - 2.7
   - 3.4 
+  - 3.5
 
 services:
   - mongodb

+ 8 - 3
ChangeLog

@@ -1,9 +1,14 @@
+2016-July-16 Oz Nahum Tiram <oz.tiram@gmail.com>
+	* Release 0.8.1 - Tag only, not on pypi
+	* Fixes of Python2 - Python3 compatablity issues
+	* Pure AES module converted with 2to3 to python3
+
 2016-July-O4 Oz Nahum Tiram <oz.tiram@gmail.com>
 	* Release 0.8.0
 	* Remove automatic build of man page. Explicit build is still possible.
-    * Add pure Python AES module
-    * On systems where Pycrypto is not available use own AES
-     
+	* Add pure Python AES module
+	* On systems where Pycrypto is not available use own AES
+
 2016-Jan-15 Oz Nahum Tiram <nahumoz@gmail.com>
 	* Release 0.7.4
 	* Fix typo in setup.py which affects windows installation

+ 1 - 3
pwman/__init__.py

@@ -20,10 +20,8 @@
 # ============================================================================
 import os
 import argparse
-import sys
 import re
 import string
-import colorama
 import pkg_resources
 from pwman.util import config
 from pwman.data.factory import check_db_version
@@ -33,7 +31,7 @@ appname = "pwman3"
 try:
     version = pkg_resources.get_distribution('pwman3').version
 except pkg_resources.DistributionNotFound:  # pragma: no cover
-    version = "0.8.0"
+        version = "0.8.1"
 
 
 class PkgMetadata(object):

+ 13 - 5
pwman/data/nodes.py

@@ -18,6 +18,7 @@
 # ============================================================================
 # Copyright (C) 2006 Ivan Kelly <ivan@ivankelly.net>
 # ============================================================================
+from builtins import bytes
 from colorama import Fore
 from pwman.util.crypto_engine import CryptoEngine
 import pwman.ui.tools
@@ -72,11 +73,18 @@ class Node(object):
         the encrypted entities from the database
         """
         node = Node(clear_text=False)
-        node._username = bytes(username).strip()
-        node._password = bytes(password).strip()
-        node._url = bytes(url).strip()
-        node._notes = bytes(notes).strip()
-        node._tags = [bytes(t).strip() for t in tags]
+        if type(username) == bytes:
+            node._username = username.strip()
+            node._password = password.strip()
+            node._url = url.strip()
+            node._notes = notes.strip()
+            node._tags = [t.strip() for t in tags] 
+        else:
+            node._username = bytes(username, 'utf8').strip()
+            node._password = bytes(password, 'utf8').strip()
+            node._url = bytes(url, 'utf8').strip()
+            node._notes = bytes(notes, 'utf8').strip()
+            node._tags = [bytes(t, 'utf8').strip() for t in tags]
         return node
 
     def __iter__(self):

+ 14 - 0
pwman/ui/templates/index.tpl

@@ -0,0 +1,14 @@
+<!DOCTYPE html>
+    <head>
+        <meta charset="utf-8">
+        <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
+        <title>Pwman3 Web</title>
+        <meta name="description" content="">
+        <meta name="viewport" content="width=device-width, initial-scale=1">
+        <link rel="stylesheet" href="/static/css/milligram.css">
+    </head>
+<body>
+
+  <h1>Hello Miligram</h1>
+</body>
+</html>

+ 0 - 157
pwman/ui/templates/static/404.html

@@ -1,157 +0,0 @@
-<!DOCTYPE html>
-<html lang="en">
-    <head>
-        <meta charset="utf-8">
-        <title>Page Not Found :(</title>
-        <style>
-            ::-moz-selection {
-                background: #b3d4fc;
-                text-shadow: none;
-            }
-
-            ::selection {
-                background: #b3d4fc;
-                text-shadow: none;
-            }
-
-            html {
-                padding: 30px 10px;
-                font-size: 20px;
-                line-height: 1.4;
-                color: #737373;
-                background: #f0f0f0;
-                -webkit-text-size-adjust: 100%;
-                -ms-text-size-adjust: 100%;
-            }
-
-            html,
-            input {
-                font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
-            }
-
-            body {
-                max-width: 500px;
-                _width: 500px;
-                padding: 30px 20px 50px;
-                border: 1px solid #b3b3b3;
-                border-radius: 4px;
-                margin: 0 auto;
-                box-shadow: 0 1px 10px #a7a7a7, inset 0 1px 0 #fff;
-                background: #fcfcfc;
-            }
-
-            h1 {
-                margin: 0 10px;
-                font-size: 50px;
-                text-align: center;
-            }
-
-            h1 span {
-                color: #bbb;
-            }
-
-            h3 {
-                margin: 1.5em 0 0.5em;
-            }
-
-            p {
-                margin: 1em 0;
-            }
-
-            ul {
-                padding: 0 0 0 40px;
-                margin: 1em 0;
-            }
-
-            .container {
-                max-width: 380px;
-                _width: 380px;
-                margin: 0 auto;
-            }
-
-            /* google search */
-
-            #goog-fixurl ul {
-                list-style: none;
-                padding: 0;
-                margin: 0;
-            }
-
-            #goog-fixurl form {
-                margin: 0;
-            }
-
-            #goog-wm-qt,
-            #goog-wm-sb {
-                border: 1px solid #bbb;
-                font-size: 16px;
-                line-height: normal;
-                vertical-align: top;
-                color: #444;
-                border-radius: 2px;
-            }
-
-            #goog-wm-qt {
-                width: 220px;
-                height: 20px;
-                padding: 5px;
-                margin: 5px 10px 0 0;
-                box-shadow: inset 0 1px 1px #ccc;
-            }
-
-            #goog-wm-sb {
-                display: inline-block;
-                height: 32px;
-                padding: 0 10px;
-                margin: 5px 0 0;
-                white-space: nowrap;
-                cursor: pointer;
-                background-color: #f5f5f5;
-                background-image: -webkit-linear-gradient(rgba(255,255,255,0), #f1f1f1);
-                background-image: -moz-linear-gradient(rgba(255,255,255,0), #f1f1f1);
-                background-image: -ms-linear-gradient(rgba(255,255,255,0), #f1f1f1);
-                background-image: -o-linear-gradient(rgba(255,255,255,0), #f1f1f1);
-                -webkit-appearance: none;
-                -moz-appearance: none;
-                appearance: none;
-                *overflow: visible;
-                *display: inline;
-                *zoom: 1;
-            }
-
-            #goog-wm-sb:hover,
-            #goog-wm-sb:focus {
-                border-color: #aaa;
-                box-shadow: 0 1px 1px rgba(0, 0, 0, 0.1);
-                background-color: #f8f8f8;
-            }
-
-            #goog-wm-qt:hover,
-            #goog-wm-qt:focus {
-                border-color: #105cb6;
-                outline: 0;
-                color: #222;
-            }
-
-            input::-moz-focus-inner {
-                padding: 0;
-                border: 0;
-            }
-        </style>
-    </head>
-    <body>
-        <div class="container">
-            <h1>Not found <span>:(</span></h1>
-            <p>Sorry, but the page you were trying to view does not exist.</p>
-            <p>It looks like this was the result of either:</p>
-            <ul>
-                <li>a mistyped address</li>
-                <li>an out-of-date link</li>
-            </ul>
-            <script>
-                var GOOG_FIXURL_LANG = (navigator.language || '').slice(0,2),GOOG_FIXURL_SITE = location.host;
-            </script>
-            <script src="//linkhelp.clients.google.com/tbproxy/lh/wm/fixurl.js"></script>
-        </div>
-    </body>
-</html>

BIN
pwman/ui/templates/static/apple-touch-icon-precomposed.png


+ 0 - 6
pwman/ui/templates/static/css/main.css

@@ -1,6 +0,0 @@
-@media screen and (min-width: 768px) {
- 
-.custom-collapse .collapse{
-  			display:block;
-      }  
-}

Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 254 - 0
pwman/ui/templates/static/css/milligram.css


+ 0 - 527
pwman/ui/templates/static/css/normalize.css

@@ -1,527 +0,0 @@
-/*! normalize.css v1.1.3 | MIT License | git.io/normalize */
-
-/* ==========================================================================
-   HTML5 display definitions
-   ========================================================================== */
-
-/**
- * Correct `block` display not defined in IE 6/7/8/9 and Firefox 3.
- */
-
-article,
-aside,
-details,
-figcaption,
-figure,
-footer,
-header,
-hgroup,
-main,
-nav,
-section,
-summary {
-    display: block;
-}
-
-/**
- * Correct `inline-block` display not defined in IE 6/7/8/9 and Firefox 3.
- */
-
-audio,
-canvas,
-video {
-    display: inline-block;
-    *display: inline;
-    *zoom: 1;
-}
-
-/**
- * Prevent modern browsers from displaying `audio` without controls.
- * Remove excess height in iOS 5 devices.
- */
-
-audio:not([controls]) {
-    display: none;
-    height: 0;
-}
-
-/**
- * Address styling not present in IE 7/8/9, Firefox 3, and Safari 4.
- * Known issue: no IE 6 support.
- */
-
-[hidden] {
-    display: none;
-}
-
-/* ==========================================================================
-   Base
-   ========================================================================== */
-
-/**
- * 1. Correct text resizing oddly in IE 6/7 when body `font-size` is set using
- *    `em` units.
- * 2. Prevent iOS text size adjust after orientation change, without disabling
- *    user zoom.
- */
-
-html {
-    font-size: 100%; /* 1 */
-    -ms-text-size-adjust: 100%; /* 2 */
-    -webkit-text-size-adjust: 100%; /* 2 */
-}
-
-/**
- * Address `font-family` inconsistency between `textarea` and other form
- * elements.
- */
-
-html,
-button,
-input,
-select,
-textarea {
-    font-family: sans-serif;
-}
-
-/**
- * Address margins handled incorrectly in IE 6/7.
- */
-
-body {
-    margin: 0;
-}
-
-/* ==========================================================================
-   Links
-   ========================================================================== */
-
-/**
- * Address `outline` inconsistency between Chrome and other browsers.
- */
-
-a:focus {
-    outline: thin dotted;
-}
-
-/**
- * Improve readability when focused and also mouse hovered in all browsers.
- */
-
-a:active,
-a:hover {
-    outline: 0;
-}
-
-/* ==========================================================================
-   Typography
-   ========================================================================== */
-
-/**
- * Address font sizes and margins set differently in IE 6/7.
- * Address font sizes within `section` and `article` in Firefox 4+, Safari 5,
- * and Chrome.
- */
-
-h1 {
-    font-size: 2em;
-    margin: 0.67em 0;
-}
-
-h2 {
-    font-size: 1.5em;
-    margin: 0.83em 0;
-}
-
-h3 {
-    font-size: 1.17em;
-    margin: 1em 0;
-}
-
-h4 {
-    font-size: 1em;
-    margin: 1.33em 0;
-}
-
-h5 {
-    font-size: 0.83em;
-    margin: 1.67em 0;
-}
-
-h6 {
-    font-size: 0.67em;
-    margin: 2.33em 0;
-}
-
-/**
- * Address styling not present in IE 7/8/9, Safari 5, and Chrome.
- */
-
-abbr[title] {
-    border-bottom: 1px dotted;
-}
-
-/**
- * Address style set to `bolder` in Firefox 3+, Safari 4/5, and Chrome.
- */
-
-b,
-strong {
-    font-weight: bold;
-}
-
-blockquote {
-    margin: 1em 40px;
-}
-
-/**
- * Address styling not present in Safari 5 and Chrome.
- */
-
-dfn {
-    font-style: italic;
-}
-
-/**
- * Address differences between Firefox and other browsers.
- * Known issue: no IE 6/7 normalization.
- */
-
-hr {
-    -moz-box-sizing: content-box;
-    box-sizing: content-box;
-    height: 0;
-}
-
-/**
- * Address styling not present in IE 6/7/8/9.
- */
-
-mark {
-    background: #ff0;
-    color: #000;
-}
-
-/**
- * Address margins set differently in IE 6/7.
- */
-
-p,
-pre {
-    margin: 1em 0;
-}
-
-/**
- * Correct font family set oddly in IE 6, Safari 4/5, and Chrome.
- */
-
-code,
-kbd,
-pre,
-samp {
-    font-family: monospace, serif;
-    _font-family: 'courier new', monospace;
-    font-size: 1em;
-}
-
-/**
- * Improve readability of pre-formatted text in all browsers.
- */
-
-pre {
-    white-space: pre;
-    white-space: pre-wrap;
-    word-wrap: break-word;
-}
-
-/**
- * Address CSS quotes not supported in IE 6/7.
- */
-
-q {
-    quotes: none;
-}
-
-/**
- * Address `quotes` property not supported in Safari 4.
- */
-
-q:before,
-q:after {
-    content: '';
-    content: none;
-}
-
-/**
- * Address inconsistent and variable font size in all browsers.
- */
-
-small {
-    font-size: 80%;
-}
-
-/**
- * Prevent `sub` and `sup` affecting `line-height` in all browsers.
- */
-
-sub,
-sup {
-    font-size: 75%;
-    line-height: 0;
-    position: relative;
-    vertical-align: baseline;
-}
-
-sup {
-    top: -0.5em;
-}
-
-sub {
-    bottom: -0.25em;
-}
-
-/* ==========================================================================
-   Lists
-   ========================================================================== */
-
-/**
- * Address margins set differently in IE 6/7.
- */
-
-dl,
-menu,
-ol,
-ul {
-    margin: 1em 0;
-}
-
-dd {
-    margin: 0 0 0 40px;
-}
-
-/**
- * Address paddings set differently in IE 6/7.
- */
-
-menu,
-ol,
-ul {
-    padding: 0 0 0 40px;
-}
-
-/**
- * Correct list images handled incorrectly in IE 7.
- */
-
-nav ul,
-nav ol {
-    list-style: none;
-    list-style-image: none;
-}
-
-/* ==========================================================================
-   Embedded content
-   ========================================================================== */
-
-/**
- * 1. Remove border when inside `a` element in IE 6/7/8/9 and Firefox 3.
- * 2. Improve image quality when scaled in IE 7.
- */
-
-img {
-    border: 0; /* 1 */
-    -ms-interpolation-mode: bicubic; /* 2 */
-}
-
-/**
- * Correct overflow displayed oddly in IE 9.
- */
-
-svg:not(:root) {
-    overflow: hidden;
-}
-
-/* ==========================================================================
-   Figures
-   ========================================================================== */
-
-/**
- * Address margin not present in IE 6/7/8/9, Safari 5, and Opera 11.
- */
-
-figure {
-    margin: 0;
-}
-
-/* ==========================================================================
-   Forms
-   ========================================================================== */
-
-/**
- * Correct margin displayed oddly in IE 6/7.
- */
-
-form {
-    margin: 0;
-}
-
-/**
- * Define consistent border, margin, and padding.
- */
-
-fieldset {
-    border: 1px solid #c0c0c0;
-    margin: 0 2px;
-    padding: 0.35em 0.625em 0.75em;
-}
-
-/**
- * 1. Correct color not being inherited in IE 6/7/8/9.
- * 2. Correct text not wrapping in Firefox 3.
- * 3. Correct alignment displayed oddly in IE 6/7.
- */
-
-legend {
-    border: 0; /* 1 */
-    padding: 0;
-    white-space: normal; /* 2 */
-    *margin-left: -7px; /* 3 */
-}
-
-/**
- * 1. Correct font size not being inherited in all browsers.
- * 2. Address margins set differently in IE 6/7, Firefox 3+, Safari 5,
- *    and Chrome.
- * 3. Improve appearance and consistency in all browsers.
- */
-
-button,
-input,
-select,
-textarea {
-    font-size: 100%; /* 1 */
-    margin: 0; /* 2 */
-    vertical-align: baseline; /* 3 */
-    *vertical-align: middle; /* 3 */
-}
-
-/**
- * Address Firefox 3+ setting `line-height` on `input` using `!important` in
- * the UA stylesheet.
- */
-
-button,
-input {
-    line-height: normal;
-}
-
-/**
- * Address inconsistent `text-transform` inheritance for `button` and `select`.
- * All other form control elements do not inherit `text-transform` values.
- * Correct `button` style inheritance in Chrome, Safari 5+, and IE 6+.
- * Correct `select` style inheritance in Firefox 4+ and Opera.
- */
-
-button,
-select {
-    text-transform: none;
-}
-
-/**
- * 1. Avoid the WebKit bug in Android 4.0.* where (2) destroys native `audio`
- *    and `video` controls.
- * 2. Correct inability to style clickable `input` types in iOS.
- * 3. Improve usability and consistency of cursor style between image-type
- *    `input` and others.
- * 4. Remove inner spacing in IE 7 without affecting normal text inputs.
- *    Known issue: inner spacing remains in IE 6.
- */
-
-button,
-html input[type="button"], /* 1 */
-input[type="reset"],
-input[type="submit"] {
-    -webkit-appearance: button; /* 2 */
-    cursor: pointer; /* 3 */
-    *overflow: visible;  /* 4 */
-}
-
-/**
- * Re-set default cursor for disabled elements.
- */
-
-button[disabled],
-html input[disabled] {
-    cursor: default;
-}
-
-/**
- * 1. Address box sizing set to content-box in IE 8/9.
- * 2. Remove excess padding in IE 8/9.
- * 3. Remove excess padding in IE 7.
- *    Known issue: excess padding remains in IE 6.
- */
-
-input[type="checkbox"],
-input[type="radio"] {
-    box-sizing: border-box; /* 1 */
-    padding: 0; /* 2 */
-    *height: 13px; /* 3 */
-    *width: 13px; /* 3 */
-}
-
-/**
- * 1. Address `appearance` set to `searchfield` in Safari 5 and Chrome.
- * 2. Address `box-sizing` set to `border-box` in Safari 5 and Chrome
- *    (include `-moz` to future-proof).
- */
-
-input[type="search"] {
-    -webkit-appearance: textfield; /* 1 */
-    -moz-box-sizing: content-box;
-    -webkit-box-sizing: content-box; /* 2 */
-    box-sizing: content-box;
-}
-
-/**
- * Remove inner padding and search cancel button in Safari 5 and Chrome
- * on OS X.
- */
-
-input[type="search"]::-webkit-search-cancel-button,
-input[type="search"]::-webkit-search-decoration {
-    -webkit-appearance: none;
-}
-
-/**
- * Remove inner padding and border in Firefox 3+.
- */
-
-button::-moz-focus-inner,
-input::-moz-focus-inner {
-    border: 0;
-    padding: 0;
-}
-
-/**
- * 1. Remove default vertical scrollbar in IE 6/7/8/9.
- * 2. Improve readability and alignment in all browsers.
- */
-
-textarea {
-    overflow: auto; /* 1 */
-    vertical-align: top; /* 2 */
-}
-
-/* ==========================================================================
-   Tables
-   ========================================================================== */
-
-/**
- * Remove most spacing between table cells.
- */
-
-table {
-    border-collapse: collapse;
-    border-spacing: 0;
-}

Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 0 - 0
pwman/ui/templates/static/css/normalize.min.css


BIN
pwman/ui/templates/static/favicon.ico


+ 0 - 87
pwman/ui/templates/static/index.html

@@ -1,87 +0,0 @@
-<!DOCTYPE html>
-<!--[if lt IE 7]>      <html class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]-->
-<!--[if IE 7]>         <html class="no-js lt-ie9 lt-ie8"> <![endif]-->
-<!--[if IE 8]>         <html class="no-js lt-ie9"> <![endif]-->
-<!--[if gt IE 8]><!--> <html class="no-js"> <!--<![endif]-->
-    <head>
-        <meta charset="utf-8">
-        <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
-        <title></title>
-        <meta name="description" content="">
-        <meta name="viewport" content="width=device-width, initial-scale=1">
-        <link rel="stylesheet" href="static/css/normalize.min.css">
-        <link rel="stylesheet" href="static/css/main.css">
-
-        <script src="js/vendor/modernizr-2.6.2-respond-1.1.0.min.js"></script>
-    </head>
-    <body>
-        <!--[if lt IE 7]>
-            <p class="browsehappy">You are using an <strong>outdated</strong> browser. Please <a href="http://browsehappy.com/">upgrade your browser</a> to improve your experience.</p>
-        <![endif]-->
-
-        <div class="header-container">
-            <header class="wrapper clearfix">
-                <h1 class="title">h1.title</h1>
-                <nav>
-                    <ul>
-                        <li><a href="#">nav ul li a</a></li>
-                        <li><a href="#">nav ul li a</a></li>
-                        <li><a href="#">nav ul li a</a></li>
-                    </ul>
-                </nav>
-            </header>
-        </div>
-
-        <div class="main-container">
-            <div class="main wrapper clearfix">
-
-                <article>
-                    <header>
-                        <h1>article header h1</h1>
-                        <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aliquam sodales urna non odio egestas tempor. Nunc vel vehicula ante. Etiam bibendum iaculis libero, eget molestie nisl pharetra in. In semper consequat est, eu porta velit mollis nec.</p>
-                    </header>
-                    <section>
-                        <h2>article section h2</h2>
-                        <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aliquam sodales urna non odio egestas tempor. Nunc vel vehicula ante. Etiam bibendum iaculis libero, eget molestie nisl pharetra in. In semper consequat est, eu porta velit mollis nec. Curabitur posuere enim eget turpis feugiat tempor. Etiam ullamcorper lorem dapibus velit suscipit ultrices. Proin in est sed erat facilisis pharetra.</p>
-                    </section>
-                    <section>
-                        <h2>article section h2</h2>
-                        <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aliquam sodales urna non odio egestas tempor. Nunc vel vehicula ante. Etiam bibendum iaculis libero, eget molestie nisl pharetra in. In semper consequat est, eu porta velit mollis nec. Curabitur posuere enim eget turpis feugiat tempor. Etiam ullamcorper lorem dapibus velit suscipit ultrices. Proin in est sed erat facilisis pharetra.</p>
-                    </section>
-                    <footer>
-                        <h3>article footer h3</h3>
-                        <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aliquam sodales urna non odio egestas tempor. Nunc vel vehicula ante. Etiam bibendum iaculis libero, eget molestie nisl pharetra in. In semper consequat est, eu porta velit mollis nec. Curabitur posuere enim eget turpis feugiat tempor.</p>
-                    </footer>
-                </article>
-
-                <aside>
-                    <h3>aside</h3>
-                    <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aliquam sodales urna non odio egestas tempor. Nunc vel vehicula ante. Etiam bibendum iaculis libero, eget molestie nisl pharetra in. In semper consequat est, eu porta velit mollis nec. Curabitur posuere enim eget turpis feugiat tempor. Etiam ullamcorper lorem dapibus velit suscipit ultrices.</p>
-                </aside>
-
-            </div> <!-- #main -->
-        </div> <!-- #main-container -->
-
-        <div class="footer-container">
-            <footer class="wrapper">
-                <h3>footer</h3>
-            </footer>
-        </div>
-
-        <script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.js"></script>
-        <script>window.jQuery || document.write('<script src="js/vendor/jquery-1.11.0.js"><\/script>')</script>
-
-        <script src="js/plugins.js"></script>
-        <script src="js/main.js"></script>
-
-        <!-- Google Analytics: change UA-XXXXX-X to be your site's ID. -->
-        <script>
-            (function(b,o,i,l,e,r){b.GoogleAnalyticsObject=l;b[l]||(b[l]=
-            function(){(b[l].q=b[l].q||[]).push(arguments)});b[l].l=+new Date;
-            e=o.createElement(i);r=o.getElementsByTagName(i)[0];
-            e.src='//www.google-analytics.com/analytics.js';
-            r.parentNode.insertBefore(e,r)}(window,document,'script','ga'));
-            ga('create','UA-XXXXX-X');ga('send','pageview');
-        </script>
-    </body>
-</html>

+ 0 - 1
pwman/ui/templates/static/js/main.js

@@ -1 +0,0 @@
-

+ 2 - 2
pwman/util/crypto/AES.py

@@ -24,8 +24,8 @@ IN THE SOFTWARE.
 This code is taken from https://github.com/doegox/python-cryptoplus/
 
 """
-from blockcipher import *
-from rijndael import rijndael
+from .blockcipher import *
+from .rijndael import rijndael
 
 def new(key,mode=MODE_ECB,IV=None,counter=None,segment_size=None):
     """Create a new cipher object

+ 27 - 26
pwman/util/crypto/blockcipher.py

@@ -20,8 +20,9 @@
 # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 # THE SOFTWARE.
 # =============================================================================
-import util
-import padding
+from . import util
+from . import padding
+import collections
 
 MODE_ECB = 1
 MODE_CBC = 2
@@ -55,36 +56,36 @@ class BlockCipher():
         else:
             self.IV = IV
 
-        if mode <> MODE_XTS:
+        if mode != MODE_XTS:
             self.cipher = cipher_module(self.key,**args)
         if mode == MODE_ECB:
             self.chain = ECB(self.cipher, self.blocksize)
         elif mode == MODE_CBC:
-            if len(self.IV) <> self.blocksize:
-                raise Exception,"the IV length should be %i bytes"%self.blocksize
+            if len(self.IV) != self.blocksize:
+                raise Exception("the IV length should be %i bytes"%self.blocksize)
             self.chain = CBC(self.cipher, self.blocksize,self.IV)
         elif mode == MODE_CFB:
-            if len(self.IV) <> self.blocksize:
-                raise Exception,"the IV length should be %i bytes"%self.blocksize
+            if len(self.IV) != self.blocksize:
+                raise Exception("the IV length should be %i bytes"%self.blocksize)
             if segment_size == None:
-                raise ValueError,"segment size must be defined explicitely for CFB mode"
-            if segment_size > self.blocksize*8 or segment_size%8 <> 0:
+                raise ValueError("segment size must be defined explicitely for CFB mode")
+            if segment_size > self.blocksize*8 or segment_size%8 != 0:
                 # current CFB implementation doesn't support bit level acces => segment_size should be multiple of bytes
-                raise ValueError,"segment size should be a multiple of 8 bits between 8 and %i"%(self.blocksize*8)
+                raise ValueError("segment size should be a multiple of 8 bits between 8 and %i"%(self.blocksize*8))
             self.chain = CFB(self.cipher, self.blocksize,self.IV,segment_size)
         elif mode == MODE_OFB:
-            if len(self.IV) <> self.blocksize:
+            if len(self.IV) != self.blocksize:
                 raise ValueError("the IV length should be %i bytes"%self.blocksize)
             self.chain = OFB(self.cipher, self.blocksize,self.IV)
         elif mode == MODE_CTR:
-            if (counter == None) or  not callable(counter):
-                raise Exception,"Supply a valid counter object for the CTR mode"
+            if (counter == None) or  not isinstance(counter, collections.Callable):
+                raise Exception("Supply a valid counter object for the CTR mode")
             self.chain = CTR(self.cipher,self.blocksize,counter)
         elif mode == MODE_XTS:
-            if self.blocksize <> 16:
-                raise Exception,'XTS only works with blockcipher that have a 128-bit blocksize'
+            if self.blocksize != 16:
+                raise Exception('XTS only works with blockcipher that have a 128-bit blocksize')
             if not(type(key) == tuple and len(key) == 2):
-                raise Exception,'Supply two keys as a tuple when using XTS'
+                raise Exception('Supply two keys as a tuple when using XTS')
             if 'keylen_valid' in dir(self): #wrappers for pycrypto functions don't have this function
              if not self.keylen_valid(key[0]) or  not self.keylen_valid(key[1]):
                 raise ValueError(self.key_error_message)
@@ -93,10 +94,10 @@ class BlockCipher():
             self.chain = XTS(self.cipher, self.cipher2)
         elif mode == MODE_CMAC:
             if self.blocksize not in (8,16):
-                raise Exception,'CMAC only works with blockcipher that have a 64 or 128-bit blocksize'
+                raise Exception('CMAC only works with blockcipher that have a 64 or 128-bit blocksize')
             self.chain = CMAC(self.cipher,self.blocksize,self.IV)
         else:
-                raise Exception,"Unknown chaining mode!"
+                raise Exception("Unknown chaining mode!")
 
     def encrypt(self,plaintext,n=''):
         """Encrypt some plaintext
@@ -249,7 +250,7 @@ class ECB:
         self.cache += data
         if len(self.cache) < self.blocksize:
             return ''
-        for i in xrange(0, len(self.cache)-self.blocksize+1, self.blocksize):
+        for i in range(0, len(self.cache)-self.blocksize+1, self.blocksize):
             #the only difference between encryption/decryption in the chain is the cipher block
             if ed == 'e':
                 output_blocks.append(self.codebook.encrypt( self.cache[i:i + self.blocksize] ))
@@ -287,7 +288,7 @@ class CBC:
             self.cache += data
             if len(self.cache) < self.blocksize:
                 return ''
-            for i in xrange(0, len(self.cache)-self.blocksize+1, self.blocksize):
+            for i in range(0, len(self.cache)-self.blocksize+1, self.blocksize):
                 self.IV = self.codebook.encrypt(util.xorstring(self.cache[i:i+self.blocksize],self.IV))
                 encrypted_blocks += self.IV
             self.cache = self.cache[i+self.blocksize:]
@@ -297,7 +298,7 @@ class CBC:
             self.cache += data
             if len(self.cache) < self.blocksize:
                 return ''
-            for i in xrange(0, len(self.cache)-self.blocksize+1, self.blocksize):
+            for i in range(0, len(self.cache)-self.blocksize+1, self.blocksize):
                 plaintext = util.xorstring(self.IV,self.codebook.decrypt(self.cache[i:i + self.blocksize]))
                 self.IV = self.cache[i:i + self.blocksize]
                 decrypted_blocks+=plaintext
@@ -333,7 +334,7 @@ class CFB:
         """
         output = list(data)
 
-        for i in xrange(len(data)):
+        for i in range(len(data)):
             if ed =='e':
                 if len(self.keystream) == 0:
                     block = self.codebook.encrypt(self.IV)
@@ -380,7 +381,7 @@ class OFB:
         blocksize = self.blocksize
         output = list(data)
 
-        for i in xrange(n):
+        for i in range(n):
             if len(self.keystream) == 0: #encrypt a new counter block when the current keystream is fully used
                 self.IV = self.codebook.encrypt(self.IV)
                 self.keystream = list(self.IV)
@@ -420,7 +421,7 @@ class CTR:
         blocksize = self.blocksize
 
         output = list(data)
-        for i in xrange(n):
+        for i in range(n):
             if len(self.keystream) == 0: #encrypt a new counter block when the current keystream is fully used
                 block = self.codebook.encrypt(self.counter())
                 self.keystream = list(block)
@@ -504,7 +505,7 @@ class XTS:
         # if (Cout)
         if self.T >> (8*16):
             #T[0] ^= GF_128_FDBK;
-            self.T = self.T ^ 0x100000000000000000000000000000087L
+            self.T = self.T ^ 0x100000000000000000000000000000087
 
 
 class CMAC:
@@ -520,7 +521,7 @@ class CMAC:
     # TODO: change update behaviour to .update() and .digest() as for all hash modules?
     #       -> other hash functions in pycrypto: calling update, concatenates current input with previous input and hashes everything
     __Rb_dictionary = {64:0x000000000000001b,128:0x00000000000000000000000000000087}
-    supported_blocksizes = __Rb_dictionary.keys()
+    supported_blocksizes = list(__Rb_dictionary.keys())
     def __init__(self,codebook,blocksize,IV):
         # Purpose of init: calculate Lu & Lu2
         #blocksize (in bytes): to select the Rb constant in the dictionary

+ 12 - 12
pwman/util/crypto/padding.py

@@ -54,12 +54,12 @@ def bitPadding (padData, direction, length=None):
             'test'"""
         if direction == PAD:
             if length == None:
-                raise ValueError,"Supply a valid length"
+                raise ValueError("Supply a valid length")
             return __bitPadding(padData, length)
         elif direction == UNPAD:
             return __bitPadding_unpad(padData)
         else:
-            raise ValueError,"Supply a valid direction"
+            raise ValueError("Supply a valid direction")
 
 def __bitPadding (toPad,length):
     padded = toPad + '\x80' + '\x00'*(length - len(toPad)%length -1)
@@ -96,12 +96,12 @@ def zerosPadding (padData, direction, length=None):
             '12345678'"""
         if direction == PAD:
             if length == None:
-                raise ValueError,"Supply a valid length"
+                raise ValueError("Supply a valid length")
             return __zerosPadding(padData, length)
         elif direction == UNPAD:
             return __zerosPadding_unpad(padData)
         else:
-            raise ValueError,"Supply a valid direction"
+            raise ValueError("Supply a valid direction")
 
 def __zerosPadding (toPad, length):
     padLength = (length - len(toPad))%length
@@ -133,12 +133,12 @@ def PKCS7(padData, direction, length=None):
             '12345678'"""
         if direction == PAD:
             if length == None:
-                raise ValueError,"Supply a valid length"
+                raise ValueError("Supply a valid length")
             return __PKCS7(padData, length)
         elif direction == UNPAD:
             return __PKCS7_unpad(padData)
         else:
-            raise ValueError,"Supply a valid direction"
+            raise ValueError("Supply a valid direction")
 
 
 def __PKCS7 (toPad, length):
@@ -155,7 +155,7 @@ def __PKCS7_unpad (padded):
         return padded[:-length]
     else:
         return padded
-        print 'error: padding pattern not recognized'
+        print('error: padding pattern not recognized')
 
 def ANSI_X923 (padData, direction, length=None):
         """Pad a string using ANSI_X923
@@ -180,12 +180,12 @@ def ANSI_X923 (padData, direction, length=None):
             '12345678'"""
         if direction == PAD:
             if length == None:
-                raise ValueError,"Supply a valid length"
+                raise ValueError("Supply a valid length")
             return __ANSI_X923(padData, length)
         elif direction == UNPAD:
             return __ANSI_X923_unpad(padData)
         else:
-            raise ValueError,"Supply a valid direction"
+            raise ValueError("Supply a valid direction")
 
 def __ANSI_X923 (toPad, length):
     bytesToPad = length - len(toPad)%length
@@ -199,7 +199,7 @@ def __ANSI_X923_unpad (padded):
     if padded.count('\x00',-length,-1) == length - 1:
         return padded[:-length]
     else:
-        print 'error: padding pattern not recognized %s' % padded.count('\x00',-length,-1)
+        print('error: padding pattern not recognized %s' % padded.count('\x00',-length,-1))
         return padded
 
 def ISO_10126 (padData, direction, length=None):
@@ -224,12 +224,12 @@ def ISO_10126 (padData, direction, length=None):
             '12345678'"""
         if direction == PAD:
             if length == None:
-                raise ValueError,"Supply a valid length"
+                raise ValueError("Supply a valid length")
             return __ISO_10126(padData, length)
         elif direction == UNPAD:
             return __ISO_10126_unpad(padData)
         else:
-            raise ValueError,"Supply a valid direction"
+            raise ValueError("Supply a valid direction")
 
 def __ISO_10126 (toPad, length):
     bytesToPad = length - len(toPad)%length

+ 42 - 42
pwman/util/crypto/rijndael.py

@@ -89,14 +89,14 @@ A = [[1, 1, 1, 1, 1, 0, 0, 0],
 # produce log and alog tables, needed for multiplying in the
 # field GF(2^m) (generator = 3)
 alog = [1]
-for i in xrange(255):
+for i in range(255):
     j = (alog[-1] << 1) ^ alog[-1]
     if j & 0x100 != 0:
         j ^= 0x11B
     alog.append(j)
 
 log = [0] * 256
-for i in xrange(1, 255):
+for i in range(1, 255):
     log[alog[i]] = i
 
 # multiply two elements of GF(2^m)
@@ -106,29 +106,29 @@ def mul(a, b):
     return alog[(log[a & 0xFF] + log[b & 0xFF]) % 255]
 
 # substitution box based on F^{-1}(x)
-box = [[0] * 8 for i in xrange(256)]
+box = [[0] * 8 for i in range(256)]
 box[1][7] = 1
-for i in xrange(2, 256):
+for i in range(2, 256):
     j = alog[255 - log[i]]
-    for t in xrange(8):
+    for t in range(8):
         box[i][t] = (j >> (7 - t)) & 0x01
 
 B = [0, 1, 1, 0, 0, 0, 1, 1]
 
 # affine transform:  box[i] <- B + A*box[i]
-cox = [[0] * 8 for i in xrange(256)]
-for i in xrange(256):
-    for t in xrange(8):
+cox = [[0] * 8 for i in range(256)]
+for i in range(256):
+    for t in range(8):
         cox[i][t] = B[t]
-        for j in xrange(8):
+        for j in range(8):
             cox[i][t] ^= A[t][j] * box[i][j]
 
 # S-boxes and inverse S-boxes
 S =  [0] * 256
 Si = [0] * 256
-for i in xrange(256):
+for i in range(256):
     S[i] = cox[i][0] << 7
-    for t in xrange(1, 8):
+    for t in range(1, 8):
         S[i] ^= cox[i][t] << (7-t)
     Si[S[i] & 0xFF] = i
 
@@ -138,36 +138,36 @@ G = [[2, 1, 1, 3],
     [1, 3, 2, 1],
     [1, 1, 3, 2]]
 
-AA = [[0] * 8 for i in xrange(4)]
+AA = [[0] * 8 for i in range(4)]
 
-for i in xrange(4):
-    for j in xrange(4):
+for i in range(4):
+    for j in range(4):
         AA[i][j] = G[i][j]
         AA[i][i+4] = 1
 
-for i in xrange(4):
+for i in range(4):
     pivot = AA[i][i]
     if pivot == 0:
         t = i + 1
         while AA[t][i] == 0 and t < 4:
             t += 1
             assert t != 4, 'G matrix must be invertible'
-            for j in xrange(8):
+            for j in range(8):
                 AA[i][j], AA[t][j] = AA[t][j], AA[i][j]
             pivot = AA[i][i]
-    for j in xrange(8):
+    for j in range(8):
         if AA[i][j] != 0:
             AA[i][j] = alog[(255 + log[AA[i][j] & 0xFF] - log[pivot & 0xFF]) % 255]
-    for t in xrange(4):
+    for t in range(4):
         if i != t:
-            for j in xrange(i+1, 8):
+            for j in range(i+1, 8):
                 AA[t][j] ^= mul(AA[i][j], AA[t][i])
             AA[t][i] = 0
 
-iG = [[0] * 4 for i in xrange(4)]
+iG = [[0] * 4 for i in range(4)]
 
-for i in xrange(4):
-    for j in xrange(4):
+for i in range(4):
+    for j in range(4):
         iG[i][j] = AA[i][j + 4]
 
 def mul4(a, bs):
@@ -193,7 +193,7 @@ U2 = []
 U3 = []
 U4 = []
 
-for t in xrange(256):
+for t in range(256):
     s = S[t]
     T1.append(mul4(s, G[0]))
     T2.append(mul4(s, G[1]))
@@ -214,7 +214,7 @@ for t in xrange(256):
 # round constants
 rcon = [1]
 r = 1
-for t in xrange(1, 30):
+for t in range(1, 30):
     r = mul(2, r)
     rcon.append(r)
 
@@ -247,15 +247,15 @@ class rijndael:
         ROUNDS = num_rounds[len(key)][block_size]
         BC = block_size / 4
         # encryption round keys
-        Ke = [[0] * BC for i in xrange(ROUNDS + 1)]
+        Ke = [[0] * BC for i in range(ROUNDS + 1)]
         # decryption round keys
-        Kd = [[0] * BC for i in xrange(ROUNDS + 1)]
+        Kd = [[0] * BC for i in range(ROUNDS + 1)]
         ROUND_KEY_COUNT = (ROUNDS + 1) * BC
         KC = len(key) / 4
 
         # copy user material bytes into temporary ints
         tk = []
-        for i in xrange(0, KC):
+        for i in range(0, KC):
             tk.append((ord(key[i * 4]) << 24) | (ord(key[i * 4 + 1]) << 16) |
                 (ord(key[i * 4 + 2]) << 8) | ord(key[i * 4 + 3]))
 
@@ -279,17 +279,17 @@ class rijndael:
                      (rcon[rconpointer]    & 0xFF) << 24
             rconpointer += 1
             if KC != 8:
-                for i in xrange(1, KC):
+                for i in range(1, KC):
                     tk[i] ^= tk[i-1]
             else:
-                for i in xrange(1, KC / 2):
+                for i in range(1, KC / 2):
                     tk[i] ^= tk[i-1]
                 tt = tk[KC / 2 - 1]
                 tk[KC / 2] ^= (S[ tt        & 0xFF] & 0xFF)       ^ \
                               (S[(tt >>  8) & 0xFF] & 0xFF) <<  8 ^ \
                               (S[(tt >> 16) & 0xFF] & 0xFF) << 16 ^ \
                               (S[(tt >> 24) & 0xFF] & 0xFF) << 24
-                for i in xrange(KC / 2 + 1, KC):
+                for i in range(KC / 2 + 1, KC):
                     tk[i] ^= tk[i-1]
             # copy values into round key arrays
             j = 0
@@ -299,8 +299,8 @@ class rijndael:
                 j += 1
                 t += 1
         # inverse MixColumn where needed
-        for r in xrange(1, ROUNDS):
-            for j in xrange(BC):
+        for r in range(1, ROUNDS):
+            for j in range(BC):
                 tt = Kd[r][j]
                 Kd[r][j] = U1[(tt >> 24) & 0xFF] ^ \
                            U2[(tt >> 16) & 0xFF] ^ \
@@ -329,14 +329,14 @@ class rijndael:
         # temporary work array
         t = []
         # plaintext to ints + key
-        for i in xrange(BC):
+        for i in range(BC):
             t.append((ord(plaintext[i * 4    ]) << 24 |
                       ord(plaintext[i * 4 + 1]) << 16 |
                       ord(plaintext[i * 4 + 2]) <<  8 |
                       ord(plaintext[i * 4 + 3])        ) ^ Ke[0][i])
         # apply round transforms
-        for r in xrange(1, ROUNDS):
-            for i in xrange(BC):
+        for r in range(1, ROUNDS):
+            for i in range(BC):
                 a[i] = (T1[(t[ i           ] >> 24) & 0xFF] ^
                         T2[(t[(i + s1) % BC] >> 16) & 0xFF] ^
                         T3[(t[(i + s2) % BC] >>  8) & 0xFF] ^
@@ -344,13 +344,13 @@ class rijndael:
             t = copy.copy(a)
         # last round is special
         result = []
-        for i in xrange(BC):
+        for i in range(BC):
             tt = Ke[ROUNDS][i]
             result.append((S[(t[ i           ] >> 24) & 0xFF] ^ (tt >> 24)) & 0xFF)
             result.append((S[(t[(i + s1) % BC] >> 16) & 0xFF] ^ (tt >> 16)) & 0xFF)
             result.append((S[(t[(i + s2) % BC] >>  8) & 0xFF] ^ (tt >>  8)) & 0xFF)
             result.append((S[ t[(i + s3) % BC]        & 0xFF] ^  tt       ) & 0xFF)
-        return string.join(map(chr, result), '')
+        return string.join(list(map(chr, result)), '')
 
     def decrypt(self, ciphertext):
         if len(ciphertext) != self.block_size:
@@ -372,14 +372,14 @@ class rijndael:
         # temporary work array
         t = [0] * BC
         # ciphertext to ints + key
-        for i in xrange(BC):
+        for i in range(BC):
             t[i] = (ord(ciphertext[i * 4    ]) << 24 |
                     ord(ciphertext[i * 4 + 1]) << 16 |
                     ord(ciphertext[i * 4 + 2]) <<  8 |
                     ord(ciphertext[i * 4 + 3])        ) ^ Kd[0][i]
         # apply round transforms
-        for r in xrange(1, ROUNDS):
-            for i in xrange(BC):
+        for r in range(1, ROUNDS):
+            for i in range(BC):
                 a[i] = (T5[(t[ i           ] >> 24) & 0xFF] ^
                         T6[(t[(i + s1) % BC] >> 16) & 0xFF] ^
                         T7[(t[(i + s2) % BC] >>  8) & 0xFF] ^
@@ -387,13 +387,13 @@ class rijndael:
             t = copy.copy(a)
         # last round is special
         result = []
-        for i in xrange(BC):
+        for i in range(BC):
             tt = Kd[ROUNDS][i]
             result.append((Si[(t[ i           ] >> 24) & 0xFF] ^ (tt >> 24)) & 0xFF)
             result.append((Si[(t[(i + s1) % BC] >> 16) & 0xFF] ^ (tt >> 16)) & 0xFF)
             result.append((Si[(t[(i + s2) % BC] >>  8) & 0xFF] ^ (tt >>  8)) & 0xFF)
             result.append((Si[ t[(i + s3) % BC]        & 0xFF] ^  tt       ) & 0xFF)
-        return string.join(map(chr, result), '')
+        return string.join(list(map(chr, result)), '')
 
 def encrypt(key, block):
     return rijndael(key, len(block)).encrypt(block)

+ 3 - 2
scripts/webui.py

@@ -183,7 +183,7 @@ def listnodes(apply=['require_login']):
     nodesd = _nodes_inst
     ce = CryptoEngine.get()
     tags = [ce.decrypt(t).decode() for t in DB.listtags()]
-    html_nodes = template("main.tpl", nodes=nodesd, tags=tags, request=request,
+    html_nodes = template("index.tpl", nodes=nodesd, tags=tags, request=request,
                           template_lookup=[resource_filename('pwman',
                                                              'ui/templates')])
     return html_nodes
@@ -202,11 +202,12 @@ class Pwman3WebDaemon(object):
     def run(self):
         global AUTHENTICATED, TAGS, DB
         OSX = False
-        sys.argv = []
+        print(sys.argv)
         args = parser_options().parse_args()
         xselpath, dburi, configp = get_conf_options(args, OSX)
         DB = pwman.data.factory.createdb(dburi, None)
         DB.open()
+        print(dburi)
         print(dir(DB))
         CryptoEngine.get()
         debug(True)

+ 5 - 2
setup.py

@@ -318,7 +318,10 @@ class PyCryptoInstallCommand(install):
                    'to install pycrypto ...'))
 
 
-install_requires=['colorama>=0.2.4']
+install_requires = ['colorama>=0.2.4']
+
+if sys.version_info.major < 3:
+    install_requires.append("future")
 
 if sys.platform.startswith('win'):
     install_requires.append('pyreadline')
@@ -333,7 +336,7 @@ Pwman3 supports MySQL, Postgresql and SQLite and even MongoDB"""
 
 
 setup(name='pwman3',
-      version='0.8.0',
+      version='0.8.1',
       description = "a command line password manager with support for multiple databases.",
       long_description=long_description,
       author='Oz Nahum Tiram',

+ 3 - 3
tests/test_base_ui.py

@@ -92,9 +92,9 @@ class TestBaseUI(unittest.TestCase):
     def test_2_do_list(self):
         self.output = StringIO()
         sys.stdout = self.output
-        self.tester.cli.do_list('')
-        self.tester.cli.do_list('foo')
-        self.tester.cli.do_list('bar')
+        self.tester.cli.do_list(u'')
+        self.tester.cli.do_list(u'foo')
+        self.tester.cli.do_list(u'bar')
         sys.stdout = sys.__stdout__
         self.output.getvalue()
 

Một số tệp đã không được hiển thị bởi vì quá nhiều tập tin thay đổi trong này khác