Exemplo n.º 1
0
	output_type = sys.argv[3]

sid = sys.argv[1]
server_list = parse_http_notary_list(sys.argv[2]) 

for s in server_list: 
	try:
		s["results"] = None
		server = s["host"].split(":")[0]
		port = s["host"].split(":")[1]
		code, xml_text = fetch_notary_xml(server,int(port), sid)
		if code == 404: 
			pass
		if code != 200: 
			print("'%s' returned error code: %s" % (s["host"],code))
		elif not verify_notary_signature(sid, xml_text, s["public_key"]):
			print("Signature from '%s' failed, ignoring results" % s["host"])
		else: 
			# results are good
			s["results"] = xml_text
			
	except Exception, e:
		print("Exception contacting notary server:")
		traceback.print_exc(e)

if output_type == "text":
	for s in server_list:
		print(50 * "*")
		print("Results for notary server '%s'" % s["host"])
		if s["results"] is None: 
			print("<No notary results>")
Exemplo n.º 2
0
from __future__ import print_function

import time
import sys
import traceback
from client_common import verify_notary_signature, fetch_notary_xml, parse_http_notary_list
from generate_svg import get_svg_graph

if len(sys.argv) != 4:
    print("usage: %s <service-id> <notary-list-file> <len-days>" % sys.argv[0])
    exit(1)


sid = sys.argv[1]
server_list = parse_http_notary_list(sys.argv[2])

for s in server_list:
    try:
        s["results"] = None
        server = s["host"].split(":")[0]
        port = s["host"].split(":")[1]
        code, xml_text = fetch_notary_xml(server, int(port), sid)
        if code == 200 and verify_notary_signature(sid, xml_text, s["public_key"]):
            s["results"] = xml_text

    except Exception, e:
        pass

print(get_svg_graph(sid, server_list, int(sys.argv[3]), time.time()))
Exemplo n.º 3
0
    notary_pub_key = open(notary_pub_key_file, 'r').read()

try:
    code, xml_text = fetch_notary_xml(sys.argv[2], int(sys.argv[3]),
                                      sys.argv[1])
    if code == 404:
        print "Notary has no results"
    elif code != 200:
        print "Notary server returned error code: %s" % code
except Exception, e:
    print "Exception contacting notary server:"
    traceback.print_exc(e)
    exit(1)

print 50 * "-"
print "XML Response:"
print xml_text

print 50 * "-"

if notary_pub_key:
    if not verify_notary_signature(sys.argv[1], xml_text, notary_pub_key):
        print "Signature verify failed.  Results are not valid"
        exit(1)
else:
    print "Warning: no public key specified, not verifying notary signature"

print "Results:"

print notary_reply_as_text(xml_text)
args = parser.parse_args()

try: 
	code, xml_text = fetch_notary_xml(args.notary_server, args.notary_port, args.service_id)
	if code == 404: 
		print "Notary has no results for '%s'." % args.service_id
	elif code != 200: 
		print "Notary server returned error code: %s" % code
except Exception, e:
	print "Exception contacting notary server:" 
	traceback.print_exc(e)
	exit(1) 

print 50 * "-"
print "XML Response:" 
print xml_text

print 50 * "-"

try:
	pub_key = open(args.notary_pubkey).read()
	if not verify_notary_signature(args.service_id, xml_text, pub_key):
		print "Signature verification failed. Results are not valid."
		exit(1)
except IOError:
	print "Warning: no public key specified, not verifying notary signature."

print "Results:"

print notary_reply_as_text(xml_text) 
Exemplo n.º 5
0
try:
    code, xml_text = fetch_notary_xml(args.notary_server, args.notary_port,
                                      args.service_id)
    if code == 404:
        print "Notary has no results for '%s'." % args.service_id
    elif code != 200:
        print "Notary server returned error code: %s" % code
except Exception, e:
    print "Exception contacting notary server:"
    traceback.print_exc(e)
    exit(1)

print 50 * "-"
print "XML Response:"
print xml_text

print 50 * "-"

try:
    pub_key = open(args.notary_pubkey).read()
    if not verify_notary_signature(args.service_id, xml_text, pub_key):
        print "Signature verification failed. Results are not valid."
        exit(1)
except IOError:
    print "Warning: no public key specified, not verifying notary signature."

print "Results:"

print notary_reply_as_text(xml_text)
	notary_pub_key_file = sys.argv[4] 
	notary_pub_key = open(notary_pub_key_file,'r').read() 

try: 
	code, xml_text = fetch_notary_xml(sys.argv[2],int(sys.argv[3]), sys.argv[1])
	if code == 404: 
		print "Notary has no results"
	elif code != 200: 
		print "Notary server returned error code: %s" % code
except Exception, e:
	print "Exception contacting notary server:" 
	traceback.print_exc(e)
	exit(1) 

print 50 * "-"
print "XML Response:" 
print xml_text

print 50 * "-"

if notary_pub_key:
	if not verify_notary_signature(sys.argv[1].lower(), xml_text, notary_pub_key):
		print "Signature verify failed.  Results are not valid"
		exit(1)  
else: 
	print "Warning: no public key specified, not verifying notary signature" 

print "Results:" 

print notary_reply_as_text(xml_text) 
Exemplo n.º 7
0
#   You should have received a copy of the GNU General Public License
#   along with this program.  If not, see <http://www.gnu.org/licenses/>.

import time
import sys
import traceback
from client_common import verify_notary_signature, fetch_notary_xml, parse_http_notary_list
from generate_svg import get_svg_graph

if len(sys.argv) != 4:
    print "usage: %s <service-id> <notary-list-file> <len-days>" % sys.argv[0]
    exit(1)

sid = sys.argv[1]
server_list = parse_http_notary_list(sys.argv[2])

for s in server_list:
    try:
        s["results"] = None
        server = s["host"].split(":")[0]
        port = s["host"].split(":")[1]
        code, xml_text = fetch_notary_xml(server, int(port), sid)
        if code == 200 and verify_notary_signature(sid, xml_text,
                                                   s["public_key"]):
            s["results"] = xml_text

    except Exception, e:
        pass

print get_svg_graph(sid, server_list, int(sys.argv[3]), time.time())
Exemplo n.º 8
0
    output_type = sys.argv[3]

sid = sys.argv[1]
server_list = parse_http_notary_list(sys.argv[2])

for s in server_list:
    try:
        s["results"] = None
        server = s["host"].split(":")[0]
        port = s["host"].split(":")[1]
        code, xml_text = fetch_notary_xml(server, int(port), sid)
        if code == 404:
            pass
        if code != 200:
            print "'%s' returned error code: %s" % (s["host"], code)
        elif not verify_notary_signature(sid, xml_text, s["public_key"]):
            print "Signature from '%s' failed, ignoring results" % s["host"]
        else:
            # results are good
            s["results"] = xml_text

    except Exception, e:
        print "Exception contacting notary server:"
        traceback.print_exc(e)

if output_type == "text":
    for s in server_list:
        print 50 * "*"
        print "Results for notary server '%s'" % s["host"]
        if s["results"] is None:
            print "<No notary results>"