1. Markus Tzoe
  2. pwdgengo

Commits

Markus Tzoe  committed 50aaeef

add config sample; add String() to Config

  • Participants
  • Parent commits 6235ae7
  • Branches master

Comments (0)

Files changed (2)

File config.xml

View file
+<?xml version="1.0" encoding="utf-8" ?>
+<!--
+// Copyright 2011 <chaishushan@gmail.com>. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+// pwdgen config file.
+// https://bitbucket.org/chai2010/pwdgen/
+-->
+<config>
+    <!-- global salt -->
+    <salt>fuckcsdn</salt>
+    
+    <!-- site0: id0/id1/id2 -->
+    <site name="site0-0" url="http://www.site0.com/">
+        <id>id0</id>
+        <salt>site0</salt>
+        <length>16</length>
+    </site>
+    <site name="site0-1" url="http://www.site0.com/">
+        <id>id1</id>
+        <salt>site0</salt>
+        <length>16</length>
+    </site>
+    <site name="site0-2" url="http://www.site0.com/">
+        <id>id3</id>
+        <salt>site0</salt>
+        <length>16</length>
+    </site>
+    
+    <!-- site1: id0/id1 -->
+    <site name="site1-0" url="http://www.site1.com/">
+        <id>id0</id>
+        <salt>site1</salt>
+        <length>12</length>
+    </site>
+    <site name="site1-1" url="http://www.site1.com/">
+        <id>id1</id>
+        <salt>site1</salt>
+        <length>12</length>
+    </site>
+    
+    <!-- site2/.../site9 -->
+    <site name="site2" url="http://www.site2.com/">
+        <id>id0</id>
+        <salt>site2</salt>
+        <length>8</length>
+    </site>
+    <site name="site3" url="http://www.site3.com/">
+        <id>id0</id>
+        <salt>site3</salt>
+        <length>8</length>
+    </site>
+    <site name="site4" url="http://www.site4.com/">
+        <id>id0</id>
+        <salt>site4</salt>
+        <length>8</length>
+    </site>
+    <site name="site5" url="http://www.site5.com/">
+        <id>id0</id>
+        <salt>site5</salt>
+        <length>8</length>
+    </site>
+    <site name="site6" url="http://www.site6.com/">
+        <id>id0</id>
+        <salt>site6</salt>
+        <length>8</length>
+    </site>
+    <site name="site7" url="http://www.site7.com/">
+        <id>id0</id>
+        <salt>site7</salt>
+        <length>8</length>
+    </site>
+    <site name="site8" url="http://www.site8.com/">
+        <id>id0</id>
+        <salt>site8</salt>
+        <length>8</length>
+    </site>
+    <site name="site9" url="http://www.site9.com/">
+        <id>id0</id>
+        <salt>site9</salt>
+        <length>8</length>
+    </site>
+    
+</config>

File pwdgen.go

View file
 	}
 }
 
+func (self *PwdConfig) String() string {
+	var s string
+	for _, site := range self.Site {
+		s += fmt.Sprintf("%s %s %s %s\n", site.Name, site.Url, site.Id, site.pwd)
+	}
+	return s
+}
+
 // save password
 func (self *PwdConfig) SavePassword(filename, site_name string) {
 	writer := os.Stdout
 	conf := NewPwdConfig(*flagConfigFile)
 	conf.GenAllPassword(*flagPassword)
 	conf.SavePassword(*flagOutputFile, flag.Arg(0))
+	fmt.Printf("%v\n", conf)
 }
 
 //-----------------------------------------------------------------------------