-
Notifications
You must be signed in to change notification settings - Fork 95
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
Showing
5 changed files
with
64 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
// | ||
// WebShellCustomInject.swift | ||
// WebShell | ||
// | ||
// Created by Wesley de Groot on 14-04-16. | ||
// Copyright © 2016 RandyLu. All rights reserved. | ||
// | ||
|
||
import Foundation | ||
import WebKit | ||
|
||
extension ViewController { | ||
/** | ||
_WSInjectJS | ||
Injects JavaScript in to a frame, or other position | ||
- Parameter jsContext: JSContext! | ||
- Note: @wdg #36 | ||
*/ | ||
internal func _WSInjectJS(jsContext: JSContext!) { | ||
// JSInject | ||
if (SETTINGS["JSInject"] as! String != "") { | ||
jsContext.evaluateScript(SETTINGS["JSInject"] as! String) | ||
} | ||
} | ||
|
||
/** | ||
_WSInjectCSS | ||
Injects CSS in to a frame, or other position | ||
- Parameter jsContext: JSContext! | ||
- Note: @wdg #36 | ||
*/ | ||
internal func _WSInjectCSS(jsContext: JSContext!) { | ||
// CSSInject | ||
if (SETTINGS["CSSInject"] as! String != "") { | ||
let css:String = (SETTINGS["CSSInject"] as! String) | ||
.stringByReplacingOccurrencesOfString("\n", withString: "") | ||
.stringByReplacingOccurrencesOfString("\r", withString: "") | ||
.stringByReplacingOccurrencesOfString("'", withString: "\\'") | ||
|
||
jsContext.evaluateScript("var css='\(css)',head=document.head,style=document.createElement('style');style.type='text/css';if (style.styleSheet){style.styleSheet.cssText = css;}else{style.appendChild(document.createTextNode(css));}head.appendChild(style);") | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters