示例#1
0
 def get(self):
     token = self.get_argument("token")
     new_ticket = ticket.Ticket()
     new_ticket.subject = self.get_argument("subject")
     new_ticket.body = self.get_argument("body")
     new_ticket.Status = ticket.Ticket.Open
     SendTicket.do_job(self, token, new_ticket)
示例#2
0
def test_asreq(vec):

    client_principal = Convert2PrincipalType(vec['user'], vec['domain'])
    auth_principal = Convert2PrincipalType('krbtgt/' + vec['domain'],
                                           vec['domain'])

    asreq = AsReq(client_principal)
    asreq.set_server_principal(auth_principal)
    asreq.set_encryption_types([vec['cipher']])
    asreq.set_passphrase(vec['passphrase'], salt=vec['salt'])
    frame = asreq.pack()

    data = helper.krb5_send_frame(frame,
                                  vec['ip'],
                                  port=vec['port'],
                                  use_tcp=vec['protocol'] == 'tcp')
    if not data:
        logging.error("No answer!")
        return None

    resp = AsRep(data)
    if not resp.is_valid():
        logging.error("Invalid response or wrong status!")
        return None

    # Extract the ticket
    raw_ticket = resp.get_ticket()

    # Get the session key from the KDC TGT
    t = ticket.Ticket(raw_ticket)
    enc_tgt = t.get_encrypted_data()
    enc_type = t.get_encryption_type()

    if enc_type == helper.ETYPE_AES256_CTS_HMAC_SHA1_96 and vec[
            'domain'] == 'IMMU8.COM':

        tgtobj = ticket.CCacheTGT()
        tgtobj.set_ciphertext(enc_tgt)
        tgtobj.set_mode(ticket.MODE_TGT)

        krbtgt_key_str = '8578fcf78a3b3a4bf4a6eb9d1067f83256938a0866e21f484b61611c0b71769d'.decode(
            'hex')
        tgtobj.set_key([enc_type, krbtgt_key_str])
        clear_tgt = tgtobj.decrypt()
        session_key1 = tgtobj.get_session_key()

        # Also get the session key from the encrypted information that us only
        # should be able to decipher.
        resp.set_passphrase(vec['passphrase'], salt=vec['salt'])
        session_key2 = resp.get_session_key()

        # It's a non fatal issue because it could be a problem of AES key exportation
        if session_key2 != session_key1:
            logging.error("Wrong session key: %s != %s" %
                          (session_key1[1], session_key2[1]))

    return (raw_ticket, session_key2)
示例#3
0
 def __init__(self, TrainNum, TrainDate, TimeO, TimeD, oID, dID):
     global lst
     self.TrainNum = TrainNum
     self.TrainDate = TrainDate
     self.TourTime = datetime.datetime.strptime(
         TimeD, "%H:%M") - datetime.datetime.strptime(TimeO, "%H:%M")
     self.prtTime = "<b>" + TimeO + "</b>" + " → " + "<b>" + TimeD + "</b>"
     self.ticket = ticket.Ticket(
         ticket.getTicket(self.TrainDate, lst, self.TrainNum))
     self.O = oID
     self.D = dID
示例#4
0
 def parse_data(fname: str) -> list:
     root = xml.etree.ElementTree.parse(fname).getroot()
     tickets = [
         ticket.Ticket(
             child.attrib['TrainId'], child.attrib['DepartureStationId'],
             child.attrib['ArrivalStationId'], child.attrib['Price'],
             datetime.time(*list(
                 map(int, child.attrib['DepartureTimeString'].split(':')))),
             datetime.time(*list(
                 map(int, child.attrib['ArrivalTimeString'].split(':')))))
         for child in root
     ]
     return tickets
示例#5
0
    def process_text(self, text):
        "Process the three part input"

        # 1. Start with the rules
        self.rules = rules.Rules(text=text, part2=self.part2)

        # 2. Process your ticket
        found = False
        for line in text:
            if found:
                self.mine = ticket.Ticket(text=line, part2=self.part2)
                break
            if line.startswith('your ticket'):
                found = True

        # 3. Process the other ticket
        found = False
        for line in text:
            if found:
                self.nearby.append(ticket.Ticket(text=line, part2=self.part2))
                continue
            if line.startswith('nearby ticket'):
                found = True
示例#6
0
def add_tickets(machine):
    for i in range(2):
        tickets1 = ticket.Ticket(time=20, discount=False, cost=280)
        tickets2 = ticket.Ticket(time=40, discount=False, cost=380)
        tickets3 = ticket.Ticket(time=60, discount=False, cost=500)
        tickets4 = ticket.Ticket(time=20, discount=True, cost=140)
        tickets5 = ticket.Ticket(time=40, discount=True, cost=190)
        tickets6 = ticket.Ticket(time=60, discount=True, cost=250)
        machine.add_tickets(tickets1, tickets2, tickets3, tickets4, tickets5, tickets6)
示例#7
0
 def do_buy(self, args):
     """Buy a Ticket"""
     self.all_tickets_sold = []
     try:
         if self.within_Date_Margin:
             for i in range(0, self.number_of_tickets):
                 newTicket = ticket.Ticket(self.year, self.month, self.day, self.discount, self.route)
                 self.all_tickets_sold.append(newTicket)
                 global all_tickets
                 all_tickets.append(newTicket)
             for i in range(0, len(self.all_tickets_sold)):
                 if self.all_tickets_sold[i].ticket_id_num != None:
                     print self.all_tickets_sold[i].get_ticket_info()
     except AttributeError as err:
         print("Need more infomation to buy a ticket")
         print err
示例#8
0
def bookTicket():
    showTrip()
    tripNumber = int(input("Enter the trip you want to select: "))
    passengerTrip = trips[tripNumber - 1]

    print("Enter Passenger details : ")
    firstname = input("Enter your first name :")
    lastname = input("Enter your last name :")
    age = input("Enter your age :")
    gender = input("Enter your gender :")
    contact = input("Enter your contact :")
    numberOfPassengers = int(input("Enter number of passengers :"))

    passenger = user.User(firstname, lastname, age, gender, contact,
                          numberOfPassengers)

    passengerTicket = ticket.Ticket(101, passenger, passengerTrip)

    passengerTicket.showDetails()
示例#9
0
    def create_ticket(self, payload):

        userid = payload["user"]["id"]
        username = payload["user"]["name"]
        channel = self.open_dm(userid)
        tkt = ticket.Ticket()
        tkt.setCreatedBy(username, userid)
        tkt.setSummary(payload["submission"]["title"])
        tkt.setDescription(payload["submission"]["description"])
        tkt.setUrgency(payload["submission"]["urgency"])
        tkt.setDMID(channel)
        tkt_num = str(tkt.createTicket())
        #<http://www.foo.com|ISD-1>
        text = "I made your ticket at {} <{}|{}> where you can add more details for the IT team to help you out".format(
            tkt.color, tkt.slackjira.jira_base_url, tkt_num)

        timestamp = self.notify_user(tkt, channel, text)
        tkt.setCreatedAt(timestamp)
        self.tickets[str(tkt_num)] = tkt
        #We can use timestamp to track overall response time
        self.notify_IT(payload, str(tkt_num))

        return tkt_num
示例#10
0
def open_ticket(message):
    ticket_output = ticket.Ticket(message.text)
    bot.send_message(message.from_user.id, ticket_output.create_ticket())
    bot.send_message(message.from_user.id,
                     "Чем я еще могу помочь?",
                     reply_markup=keyboard.menu_markup)
示例#11
0
def create_ticket(ticket_list):
    new_ticket = ticket.Ticket()
    ticket_list.append(new_ticket)
    ticket_list[-1].est_update(len(ticket_list) - 1)
    return new_ticket
示例#12
0
def main():
    """creates tickets for a release task"""
    parser = argparse.ArgumentParser(
        description='Creates tickets for release certification')
    parser.add_argument('-u',
                        '--username',
                        help='jira username',
                        default='admin')
    parser.add_argument('-p',
                        '--password',
                        help='jira password',
                        default='admin')
    parser.add_argument('-c',
                        '--config',
                        help='path to config file',
                        default='./options.ini')
    parser.add_argument('-j',
                        '--jira',
                        help='url of jira server',
                        default='http://localhost:8080')

    args = parser.parse_args()

    jira_user = args.username
    jira_pass = args.password
    jira_server = args.jira
    config_file_path = args.config
    CONFIG.read(config_file_path)

    parent_ticket = config_map('JiraOptions')['parent_ticket']
    apprenda_version = config_map('VersionInfo')['to_version']
    jira_project = config_map('JiraOptions')['project']
    jira_issue_type = config_map('JiraOptions')['issue_type']
    jira = JIRA(jira_server, basic_auth=(jira_user, jira_pass))

    parent_issue = jira.issue(parent_ticket)
    ticket_list = []

    # create clean install tickets
    clean_strings = config_map('CleanInstallSection')
    for cloud in ['single', 'hybrid']:
        ticket_to_add = ticket.Ticket(jira_project, jira_issue_type)
        ticket_to_add.format_summary(clean_strings['summary'],
                                     apprenda_version, cloud)
        ticket_to_add.format_description(clean_strings['description'])
        ticket_list.append(ticket_to_add.__dict__)

    # create upgrade tickets
    from_versions = json.loads(config_map('VersionInfo')['from_versions'])
    upgrade_strings = config_map('UpgradeSection')

    # single cloud
    for version in from_versions:
        ticket_to_add = ticket.Ticket(jira_project, jira_issue_type)
        ticket_to_add.format_summary(upgrade_strings['summary'],
                                     apprenda_version, version, "single")
        ticket_to_add.format_description(upgrade_strings['description'])
        ticket_list.append(ticket_to_add.__dict__)

    # hybrid cloud
    for version in from_versions:
        ticket_to_add = ticket.Ticket(jira_project, jira_issue_type)
        ticket_to_add.format_summary(upgrade_strings['summary'],
                                     apprenda_version, version, "hybrid")
        ticket_to_add.format_description(upgrade_strings['description'])
        ticket_list.append(ticket_to_add.__dict__)

    # create testing tickets for other tasks
    for section in CONFIG.sections():
        if 'Ticket' in section:
            strings = config_map(section)
            ticket_to_add = ticket.Ticket(jira_project, jira_issue_type)
            ticket_to_add.format_summary(strings['summary'], apprenda_version)
            ticket_to_add.format_description(strings['description'])
            ticket_list.append(ticket_to_add.__dict__)

    print 'Created {0} tickets, now sending them to Jira'.format(
        len(ticket_list))
    # send issues to jira and create tickets and links
    issues = jira.create_issues(field_list=ticket_list)

    for item in issues:
        jira.create_issue_link(
            type="Task of Story",
            outwardIssue=item['issue'].key,
            inwardIssue=parent_issue.key,
        )

    print 'Finished linking issues, exiting.'
示例#13
0
文件: main.py 项目: fpgdigdgd/qdidi
import discord
from discord.ext import commands
import bienvenue, sugg, ticket, anti

bot = commands.Bot(command_prefix="!",
                   description="AzBot",
                   intents=discord.Intents.all())
bot.remove_command("help")


@bot.event
async def on_ready():
    print("Bot en ligne")
    await bot.change_presence(activity=discord.Game("AzBot - Commissions"))


bot.add_cog(bienvenue.Bienvenue(bot))
bot.add_cog(sugg.Suggestion(bot))
bot.add_cog(ticket.Ticket(bot))
bot.add_cog(anti.OnJoinCog(bot))
bot.run("NzcyMjMwMTM4MjA0OTEzNzE1.X53pXA.fbZ_8Q1VkKVyT8j4Oe8L-xF5x10")