-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexample.py
62 lines (55 loc) · 2.18 KB
/
example.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#!/usr/bin/python
###############################################################################
# Copyright (C) 2015 Ty Brown
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# 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 logging
import os
import time
from tixbot import TixBot
if __name__ == '__main__':
# Setup constants
DB_HOST = 'database.example.com'
DB_USER = 'username'
DB_PASS = 'password'
DB_DB = 'database_name'
DB_TABLE = 'helpdesk_tickets'
# Setup logging
logfile = os.path.splitext(os.path.abspath(__file__))[0] + '.log'
logging.basicConfig(
format='%(asctime)s %(levelname)-8s %(name)-30s | %(message)s',
datefmt='%Y-%m-%d %H:%M:%S', filename=logfile,
level=logging.WARNING
)
# Setup Password Bot
passwordbot = TixBot(botname='PasswordsBot',
host=DB_HOST,
user=DB_USER,
passwd=DB_PASS,
db=DB_DB,
table=DB_TABLE)
passwordbot.set_query('status="Unassigned" '
'AND short LIKE "%password%"')
passwordbot.set_values({'priority': 'Low',
'severity': '4 - Low',
'status': 'Open',
'category': 'Password Reset',
'platform': 'Windows',
'project': 'Not Applicable'})
# Setup loop to run robots every minute
while True:
passwordbot.run_robot()
time.sleep(60)