Skip to content

Commit

Permalink
add bulk rules
Browse files Browse the repository at this point in the history
  • Loading branch information
apparition47 committed Feb 22, 2023
1 parent 9ab89b6 commit 0678558
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 2 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

## TBA

- add Cuenote rule
- add Cuenote, Moneyforward rules
- #196 fix WhatCounts rule (thanks @malwcal)

## [0.7.11] - 2022-02-12

Expand Down
3 changes: 2 additions & 1 deletion Source/MTBBlockedMessage.m
Original file line number Diff line number Diff line change
Expand Up @@ -505,6 +505,7 @@ - (NSDictionary*)getTrackerDict {
@"mixmax.com/api/track/"
],
@"Mixpanel": @[@"api.mixpanel.com/(trk|track)"],
@"Moneyforward": @[@"tm.moneyforward.com/I/"],
@"Movable Ink": @[
// @"/p/rp/\\w{16}.png", // exception for useful info, call-to-action or ad banners
@"/p/(c|u)p/\\w{16,32}/o.gif"
Expand Down Expand Up @@ -698,7 +699,7 @@ - (NSDictionary*)getTrackerDict {
@"Verizon": @[@"verizon.com/econtact/ecrm/EmailTracking.serv"],
@"VinSolutions": @[@"vinlens.com/email.ashx\\?c="],
@"Vtiger": @[@"od2.vtiger.com/shorturl.php"],
@"WhatCounts": @[@"whatcounts.com/t"],
@"WhatCounts": @[@"/t\\?c=\\d{4}&r=\\d{4}&l=\\d{2,3}&t=\\d{2}&e=\\w{48}"],
@"We Are Web": @[@"tracking.weareweb.in/index.php/campaigns/"],
@"Webtrekk": @[@"webtrekk.net"],
@"Windscribe": @[@"windscribe.com/pixel"],
Expand Down
14 changes: 14 additions & 0 deletions Unit Tests/MTBBlockedMessageTest.m
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,20 @@ - (void)testSendgrid {
XCTAssertEqual(msg.certainty, BLOCKING_RESULT_CERTAINTY_CONFIDENT_HARD_MATCH);
}

- (void)testWhatCounts {
MTBBlockedMessage *msg = [[MTBBlockedMessage alloc] initWithHtml:@"<!--STARTTTAG-->\\n<img src=\"http://marketing.yourcentre.com.au/t?c=1109&r=6455&l=445&t=10&e=BD6A538E5E55F07F21769496C4BAD3DF0CD83620A56156C8\" width=1 height=1 border=0>\\n<!--ENDTTAG-->"];
XCTAssertEqualObjects(msg.sanitizedHtml,
@"<!--STARTTTAG-->\\n\\n<!--ENDTTAG-->");
XCTAssertEqualObjects(msg.detectedTracker, @"WhatCounts");
XCTAssertEqual(msg.certainty, BLOCKING_RESULT_CERTAINTY_CONFIDENT_HARD_MATCH);

MTBBlockedMessage *msg2 = [[MTBBlockedMessage alloc] initWithHtml:@"<!--STARTTTAG-->\\n<img src=\"https://tracking.whatcounts.com/t?c=1286&r=6049&l=72&t=10&e=0217D218A1DD2DFBDB56273B045B6272E479F7D10B9C8731\" width=1 height=1 border=0>\\n<!--ENDTTAG-->"];
XCTAssertEqualObjects(msg2.sanitizedHtml,
@"<!--STARTTTAG-->\\n\\n<!--ENDTTAG-->");
XCTAssertEqualObjects(msg2.detectedTracker, @"WhatCounts");
XCTAssertEqual(msg2.certainty, BLOCKING_RESULT_CERTAINTY_CONFIDENT_HARD_MATCH);
}

- (void)testMailgun {
MTBBlockedMessage *mail1 = [[MTBBlockedMessage alloc] initWithHtml:@"<img width=\"1px\" height=\"1px\" alt=\" src=\"http://email.mgdynamic1.webpt.com/o/eJwtz81uhCAUQOGnqZtJCCoOsmA3D9Ck3ZvL5aqMIArqaJ--P-n-LM5nNZUCAItEgGMHuLk468c1Q3BYOH0vq0bKsq7b1qqOKsOlqFtRGsFrUatKKXgTXIlKSd4CIa9YAOeLUZfSyAbR3qWVgpteNQrQ1tgbsrw4pqDfsAuUMwzUOauf8_6cDrOveFrCYXiNF17opxXD7vGK59CfYcoegj1SXjyuRdImmp-BtOccWd5262KxpHg4S6mLaYDZfcGf6WNL7qDb-3hlh-Bvn4yxf3WmdFDSSwrsRWbZGMbwDa8dYfg\">"];
XCTAssertEqualObjects(mail1.sanitizedHtml, @"");
Expand Down

0 comments on commit 0678558

Please sign in to comment.