This file contains hidden or 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
import argparse | |
import os | |
import unittest | |
from typing import Type, Callable | |
import yaml | |
from langchain_community.document_loaders import DirectoryLoader, TextLoader | |
from langchain_community.document_loaders import PythonLoader | |
from langchain_core.document_loaders import BaseLoader | |
from langchain_core.output_parsers import StrOutputParser, JsonOutputParser |
This file contains hidden or 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
val isSafe = safeToRun( | |
{ banAvdEmulatorCheck() }, | |
{ banGenymotionEmulatorCheck() }, | |
{ banBluestacksEmulatorCheck() }, | |
{ isDebuggableCheck() }, | |
{ rootDetectionCheck() } | |
) | |
if (!isSafe) { | |
throw RuntimeException("Device is not safe to run") |
This file contains hidden or 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
fun saveFile(fileName: String, content: String) { | |
val file = File("/data/is/safe/to/go/here", fileName) | |
val isSafe = file | |
.verifyFile(this) { | |
File("/data/is/safe/to/go/here").allowDirectory() | |
} | |
if (isSafe) { // Without this check - what would happen? Bad things.. | |
file.writeText(content) | |
} |
This file contains hidden or 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
inline fun Context.verifyDevice(): Boolean { | |
val checks = safeToRun( | |
{ banDebugCheck() }, | |
{ blacklistedAppCheck("com.abc") }, | |
{ safeToRunCombinedCheck( | |
listOf { minOsVersionCheck(31) }, | |
listOf { minOsVersionCheck(30) } | |
) | |
}, | |
{ verifySignatureCheck("ABASDASD", "BBBBBBB") }, |
This file contains hidden or 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
fun mySecureFunction(websiteUrl : String) { | |
val isSafe = websiteUrl.urlVerification { | |
"safetorun.com".allowHost() | |
} | |
if (isSafe) { | |
loadUrl(websiteUrl) | |
} | |
} |
This file contains hidden or 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
if (TuroblinksUrlHandler.contains(url, "/verify?", true)) { | |
C3982h.nullCheck(url, "$this$proceedToParam"); | |
C3982h.nullCheck(url, "$this$extractQueryParam"); | |
C3982h.nullCheck("proceed_to", "queryKey"); | |
String queryParameter = url.toUri().getQueryParameter("proceed_to"); | |
url = queryParameter != null ? UrlKt.parseUrl(queryParameter) : null; | |
C3982h.nullCheck(url); | |
} | |
Intent intent10 = new Intent(context, WebViewActivity.class); |
This file contains hidden or 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
SafeToRun.init( | |
configure { | |
// Root beer (detect root) | |
rootDetection { | |
tolerateRoot = false | |
tolerateBusyBox = true | |
}.error() | |
// Black list certain apps |
This file contains hidden or 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
import SwiftUI | |
import shared | |
class ContentViewProxy : ObservableObject { | |
@Published | |
var listItems : [ListEntry] = [] | |
let repository = DefaultListItemRepository() | |
This file contains hidden or 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
// Set of Material typography styles to start with | |
val typography = Typography( | |
body1 = TextStyle( | |
fontFamily = FontFamily.Default, | |
fontWeight = FontWeight.Normal, | |
fontSize = 16.sp | |
) | |
/* Other default text styles to override | |
button = TextStyle( | |
fontFamily = FontFamily.Default, |
This file contains hidden or 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
val shapes = Shapes( | |
small = RoundedCornerShape(4.dp), | |
medium = RoundedCornerShape(4.dp), | |
large = RoundedCornerShape(0.dp) | |
) |
NewerOlder