Skip to content

Commit

Permalink
Done(fingers crossed)
Browse files Browse the repository at this point in the history
  • Loading branch information
aidan-gibson committed Jun 15, 2022
1 parent aba9383 commit dfd7423
Show file tree
Hide file tree
Showing 7 changed files with 358 additions and 17 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
For large amnts of tickets I get a connection timeout after a while.

### Assumptions / Decisions
This will only go as far back at Aug '21 at most (ergo two-factor tags are potentially valid for every ticket etc)

Expand Down
Empty file added lucas.txt
Empty file.
327 changes: 327 additions & 0 deletions lucas_dupes_removed.txt

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions regexConstants.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions regexConstants.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
// /i means case-insensitive, \b are word borders
export const cusAutoReplyRegex = /This inbox is monitored 8:30am - 5pm, Monday through Friday.(.*)AMAZON ECHO, ETC.\)\*\*(.*?)phone: 503-777-7525/s

export const googleDriveRegexList = [/google drive/i, /drive request/i, /google form/i]
export const googleDriveRegexList = [/google drive/i, /drive request/i, /google form/i, /shared drive/i]
export const noGoogleDriveRegexList = []
export const googleGroupRegexList = [/google group/i, /@groups.google/, /group request/i, /external users to that group/i]
export const noGoogleGroupRegexList = []
export const hardwareRegexList = [/iMac/, /hardware store/i, /hardware shop/i, /macbook pro replacement/i]
export const hardwareRegexList = [/iMac/, /hardware store/i, /hardware shop/i, /macbook pro replacement/i, /System Model:/, /System Name:/, /System Manufacturer:/, /CUS Computer Maintenance Required/i, /tracking down/i, /buy-back/i, /reed equipment/i, /adapter/i, /usb-c/i, /usbc/i, /HDMI/i, /thunderbolt/i, /vga/i, /\bdvi\b/i, /won't turn on/i, /asset number/i, /monitor/i, /camera/i, /microphone/i]
export const noHardwareRegexList = []
export const libraryRelatedRegexList = [/e-book/i, /library/i, /librarian/i, /IMC/, /LangLab/i]
export const noLibraryRelatedRegexList = []
Expand All @@ -20,10 +20,10 @@ export const noPasswordResetRegexList = []
export const phishRegexList = [/phish/i, /scam/i, /spam/i]
export const noPhishRegexList = [/Security Updates for Reed Computers/]
export const printingRegexList = [/print/i, /ipp.reed.edu/, /xerox/i, /ctx/i, /laserjet/i, /toner/i]
export const noPrintingRegexList = []
export const noPrintingRegexList = [/print barcode/i, /small print/i]
export const reedAccountsRegexList = [/new employee/i, /kerberos/i, /vpn/i, /dlist/i, /delegate/i, /setup your Reed account/i, /claim your Reed account/i, /account creation/i, /listserv/i, /accounts are scheduled to be closed/i, /reed computing accounts/i, /account tool/i, /online_forms\/protected\/computing.php/, /account_closing/, /auth group/i, /access IRIS/, /computing account/i, /email-alias-request@reed.edu/, /blackboard/i]
export const noReedAccountsRegexList = []
export const softwareRegexList = [/1password/i, /one-password/i, /onepassword/i, /OS update/i, /OS upgrade/i, /kernel/i, /adobe/i, /acrobat/i, /photoshop/i, /creative cloud/i, /premiere pro/i, /lightroom/i, /indesign/i, /CS6/, /dreamweaver/i, /premiere rush/i, /code42/i, /crash/i, /Upgrade NOT Recommended/, /Monterey/i, /RStudio/i, /mathematica/i, /wolfram/i, /medicat/i, /big sur/i, /catalina/i, /mojave/i, /high sierra/i, /operating system/i, /\bvlc\b/i, /quicktime/i, /zotero/i, /latex/i, /stata/i, /filemaker/i, /vmware/i, /software update/i, /software upgrade/i, /uninstall/i, /matlab/i, /force quit/i, /splashtop/i] //removed /\bdriver\b/i
export const softwareRegexList = [/1password/i, /one-password/i, /onepassword/i, /OS update/i, /OS upgrade/i, /kernel/i, /adobe/i, /acrobat/i, /photoshop/i, /creative cloud/i, /premiere pro/i, /lightroom/i, /indesign/i, /CS6/, /dreamweaver/i, /premiere rush/i, /code42/i, /crash/i, /Upgrade NOT Recommended/, /Monterey/i, /RStudio/i, /mathematica/i, /wolfram/i, /medicat/i, /big sur/i, /catalina/i, /mojave/i, /high sierra/i, /operating system/i, /\bvlc\b/i, /quicktime/i, /zotero/i, /latex/i, /stata/i, /filemaker/i, /vmware/i, /software update/i, /software upgrade/i, /uninstall/i, /matlab/i, /force quit/i, /splashtop/i, /license/i] //removed /\bdriver\b/i
export const noSoftwareRegexList = []
export const thesisRegexList = [/thesis/i] //[/thesis format/i, /thesis template/i, /thesis word template/i, /r template/i]
export const noThesisRegexList = [/vpn/i]
Expand Down
17 changes: 12 additions & 5 deletions rtpup.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ var pw = (0, fs_1.readFileSync)('./password.txt', 'utf-8');
var login = 'aigibson';
var reedLoginURL = 'https://weblogin.reed.edu/?cosign-help&';
//make sure u edit search to show unlimited rows, not just 50
var searchURL = 'https://help.reed.edu/Search/Results.html?Format=%27%3Cb%3E%3Ca%20href%3D%22__WebPath__%2FTicket%2FDisplay.html%3Fid%3D__id__%22%3E__id__%3C%2Fa%3E%3C%2Fb%3E%2FTITLE%3A%23%27%2C%0A%27%3Cb%3E%3Ca%20href%3D%22__WebPath__%2FTicket%2FDisplay.html%3Fid%3D__id__%22%3E__Subject__%3C%2Fa%3E%3C%2Fb%3E%2FTITLE%3ASubject%27%2C%0AStatus%2C%0AQueueName%2C%0AOwner%2C%0APriority%2C%0A%27__NEWLINE__%27%2C%0A%27__NBSP__%27%2C%0A%27%3Csmall%3E__Requestors__%3C%2Fsmall%3E%27%2C%0A%27%3Csmall%3E__CreatedRelative__%3C%2Fsmall%3E%27%2C%0A%27%3Csmall%3E__ToldRelative__%3C%2Fsmall%3E%27%2C%0A%27%3Csmall%3E__LastUpdatedRelative__%3C%2Fsmall%3E%27%2C%0A%27%3Csmall%3E__TimeLeft__%3C%2Fsmall%3E%27&Order=ASC%7CASC%7CASC%7CASC&OrderBy=id%7C%7C%7C&Query=(%20Queue%20%3D%20%27cus%27%20OR%20Queue%20%3D%20%27twatch%27%20)%20AND%20Created%20%3E%20%272022-04-30%27%20AND%20%27CF.%7BSupport%20Tags%7D%27%20IS%20NULL&RowsPerPage=0&SavedChartSearchId=new&SavedSearchId=new';
var searchURL = 'https://help.reed.edu/Search/Results.html?Format=%27%3Cb%3E%3Ca%20href%3D%22__WebPath__%2FTicket%2FDisplay.html%3Fid%3D__id__%22%3E__id__%3C%2Fa%3E%3C%2Fb%3E%2FTITLE%3A%23%27%2C%0A%27%3Cb%3E%3Ca%20href%3D%22__WebPath__%2FTicket%2FDisplay.html%3Fid%3D__id__%22%3E__Subject__%3C%2Fa%3E%3C%2Fb%3E%2FTITLE%3ASubject%27%2C%0AStatus%2C%0AQueueName%2C%0AOwner%2C%0APriority%2C%0A%27__NEWLINE__%27%2C%0A%27__NBSP__%27%2C%0A%27%3Csmall%3E__Requestors__%3C%2Fsmall%3E%27%2C%0A%27%3Csmall%3E__CreatedRelative__%3C%2Fsmall%3E%27%2C%0A%27%3Csmall%3E__ToldRelative__%3C%2Fsmall%3E%27%2C%0A%27%3Csmall%3E__LastUpdatedRelative__%3C%2Fsmall%3E%27%2C%0A%27%3Csmall%3E__TimeLeft__%3C%2Fsmall%3E%27&Order=ASC%7CASC%7CASC%7CASC&OrderBy=id%7C%7C%7C&Query=(%20Queue%20%3D%20%27cus%27%20OR%20Queue%20%3D%20%27twatch%27%20)%20AND%20Created%20%3C%20%272022-01-01%27%20AND%20Created%20%3E%20%272021-07-31%27%20AND%20%27CF.%7BSupport%20Tags%7D%27%20IS%20NULL%20AND%20id%20%3E%20332850&RowsPerPage=0&SavedChartSearchId=new&SavedSearchId=new';
function run(currentTicket) {
return __awaiter(this, void 0, void 0, function () {
var ticketURL, browser, page;
Expand Down Expand Up @@ -465,6 +465,12 @@ function ticketFix(page, currentTicket) {
else if (emails.toString().includes('[email protected]')) {
reedAccounts = true;
}
else if (ticketTitleValue.includes('CUS Computer Maintenance Required') || ticketTitleValue.includes('Tracking Down') || ticketTitleValue.includes('tracking down')) {
hardware = true;
}
else if (messages.includes('Code42')) {
software = true;
}
else {
googleDriveMatch = reg.googleDriveRegexList.some(function (rx) { return rx.test(messages); }) && !reg.noGoogleDriveRegexList.some(function (rx) { return rx.test(messages); });
googleGroupMatch = reg.googleGroupRegexList.some(function (rx) { return rx.test(messages); }) && !reg.noGoogleGroupRegexList.some(function (rx) { return rx.test(messages); });
Expand Down Expand Up @@ -791,18 +797,19 @@ function ticketFix(page, currentTicket) {
case 5:
_c.sent();
return [4 /*yield*/, page.click("button[class=\"btn btn-primary pull-right\"]")
//wait for page load. (no network requests for 5 seconds, that's super generous & borderline inefficient but whatever, this could b used on lots of tickets&a shitty connection
//wait for page load. (no network requests for idleTime ms, trying to b super generous & borderline inefficient but whatever, this could b used on lots of tickets&a shitty connection
];
case 6:
_c.sent();
//wait for page load. (no network requests for 5 seconds, that's super generous & borderline inefficient but whatever, this could b used on lots of tickets&a shitty connection
return [4 /*yield*/, page.waitForNetworkIdle({ idleTime: 5000 })];
//wait for page load. (no network requests for idleTime ms, trying to b super generous & borderline inefficient but whatever, this could b used on lots of tickets&a shitty connection
return [4 /*yield*/, page.waitForNetworkIdle({ idleTime: 10000 })];
case 7:
//wait for page load. (no network requests for 5 seconds, that's super generous & borderline inefficient but whatever, this could b used on lots of tickets&a shitty connection
//wait for page load. (no network requests for idleTime ms, trying to b super generous & borderline inefficient but whatever, this could b used on lots of tickets&a shitty connection
_c.sent();
return [4 /*yield*/, page.$$eval("tbody.list-item", function (el) { return el.map(function (x) { return x.getAttribute('data-record-id'); }); })];
case 8:
tickets = _c.sent();
console.log(tickets.length);
_a = [];
for (_b in tickets)
_a.push(_b);
Expand Down
13 changes: 9 additions & 4 deletions rtpup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ const pw = readFileSync('./password.txt', 'utf-8')
const login = 'aigibson'
const reedLoginURL = 'https://weblogin.reed.edu/?cosign-help&'
//make sure u edit search to show unlimited rows, not just 50
const searchURL = 'https://help.reed.edu/Search/Results.html?Format=%27%3Cb%3E%3Ca%20href%3D%22__WebPath__%2FTicket%2FDisplay.html%3Fid%3D__id__%22%3E__id__%3C%2Fa%3E%3C%2Fb%3E%2FTITLE%3A%23%27%2C%0A%27%3Cb%3E%3Ca%20href%3D%22__WebPath__%2FTicket%2FDisplay.html%3Fid%3D__id__%22%3E__Subject__%3C%2Fa%3E%3C%2Fb%3E%2FTITLE%3ASubject%27%2C%0AStatus%2C%0AQueueName%2C%0AOwner%2C%0APriority%2C%0A%27__NEWLINE__%27%2C%0A%27__NBSP__%27%2C%0A%27%3Csmall%3E__Requestors__%3C%2Fsmall%3E%27%2C%0A%27%3Csmall%3E__CreatedRelative__%3C%2Fsmall%3E%27%2C%0A%27%3Csmall%3E__ToldRelative__%3C%2Fsmall%3E%27%2C%0A%27%3Csmall%3E__LastUpdatedRelative__%3C%2Fsmall%3E%27%2C%0A%27%3Csmall%3E__TimeLeft__%3C%2Fsmall%3E%27&Order=ASC%7CASC%7CASC%7CASC&OrderBy=id%7C%7C%7C&Query=(%20Queue%20%3D%20%27cus%27%20OR%20Queue%20%3D%20%27twatch%27%20)%20AND%20Created%20%3E%20%272022-04-30%27%20AND%20%27CF.%7BSupport%20Tags%7D%27%20IS%20NULL&RowsPerPage=0&SavedChartSearchId=new&SavedSearchId=new'
const searchURL =
'https://help.reed.edu/Search/Results.html?Format=%27%3Cb%3E%3Ca%20href%3D%22__WebPath__%2FTicket%2FDisplay.html%3Fid%3D__id__%22%3E__id__%3C%2Fa%3E%3C%2Fb%3E%2FTITLE%3A%23%27%2C%0A%27%3Cb%3E%3Ca%20href%3D%22__WebPath__%2FTicket%2FDisplay.html%3Fid%3D__id__%22%3E__Subject__%3C%2Fa%3E%3C%2Fb%3E%2FTITLE%3ASubject%27%2C%0AStatus%2C%0AQueueName%2C%0AOwner%2C%0APriority%2C%0A%27__NEWLINE__%27%2C%0A%27__NBSP__%27%2C%0A%27%3Csmall%3E__Requestors__%3C%2Fsmall%3E%27%2C%0A%27%3Csmall%3E__CreatedRelative__%3C%2Fsmall%3E%27%2C%0A%27%3Csmall%3E__ToldRelative__%3C%2Fsmall%3E%27%2C%0A%27%3Csmall%3E__LastUpdatedRelative__%3C%2Fsmall%3E%27%2C%0A%27%3Csmall%3E__TimeLeft__%3C%2Fsmall%3E%27&Order=ASC%7CASC%7CASC%7CASC&OrderBy=id%7C%7C%7C&Query=(%20Queue%20%3D%20%27cus%27%20OR%20Queue%20%3D%20%27twatch%27%20)%20AND%20Created%20%3C%20%272022-01-01%27%20AND%20Created%20%3E%20%272021-07-31%27%20AND%20%27CF.%7BSupport%20Tags%7D%27%20IS%20NULL%20AND%20id%20%3E%20332850&RowsPerPage=0&SavedChartSearchId=new&SavedSearchId=new'

async function run(currentTicket) {
const ticketURL = 'https://help.reed.edu/Ticket/Display.html?id='
Expand Down Expand Up @@ -222,6 +223,10 @@ async function ticketFix(page: Page, currentTicket): Promise<void> {
googleGroup = true
} else if (emails.toString().includes('[email protected]')) {
reedAccounts = true
} else if (ticketTitleValue.includes('CUS Computer Maintenance Required') || ticketTitleValue.includes('Tracking Down') || ticketTitleValue.includes('tracking down')) {
hardware = true
} else if (messages.includes('Code42')) {
software = true
} else {
//regex section, only run if no hard rules found (moved regex lists outside of fnc to b global

Expand Down Expand Up @@ -524,11 +529,11 @@ async function ticketFix(page: Page, currentTicket): Promise<void> {
await page.type('[name="password"]', pw)
await page.click(`button[class="btn btn-primary pull-right"]`)

//wait for page load. (no network requests for 5 seconds, that's super generous & borderline inefficient but whatever, this could b used on lots of tickets&a shitty connection
await page.waitForNetworkIdle({ idleTime: 5000 })
//wait for page load. (no network requests for idleTime ms, trying to b super generous & borderline inefficient but whatever, this could b used on lots of tickets&a shitty connection
await page.waitForNetworkIdle({ idleTime: 10000 })

const tickets = await page.$$eval(`tbody.list-item`, (el) => el.map((x) => x.getAttribute('data-record-id')))

console.log(tickets.length)
for (const ticket in tickets) {
console.log(tickets[ticket])
await run(tickets[ticket])
Expand Down

0 comments on commit dfd7423

Please sign in to comment.