网上这个资源比较乱,改编自keil下的例程,已调试验证通过该模块启动STM32的AWU功能,采用LSI作为RTC时钟,周期性待机和唤醒单片机移植该模块:1、只需调用RTC_Alarm_Configuration配置启动函数,2、修改工作时间WORK_TIMES、待机时间STANDBY_TIMES,单位秒s, 设置的为32为闹钟寄存器,0-4294967295s(71582788.25min)
2025/12/24 5:37:03 2KB stm32f103 RTC 闹钟唤醒 单片机
1
编译原理龙书答案完整性高第二章2.2ExercisesforSection2.22.2.1Considerthecontext-freegrammar:S->SS+|SS*|aShowhowthestringaa+a*canbegeneratedbythisgrammar.Constructaparsetreeforthisstring.Whatlanguagedoesthisgrammargenerate?Justifyyouranswer.answerS->SS*->SS+S*->aS+S*->aa+S*->aa+a*L={Postfixexpressionconsistingofdigits,plusandmultiplesigns}2.2.2Whatlanguageisgeneratedbythefollowinggrammars?Ineachcasejustifyyouranswer.S->0S1|01S->+SS|-SS|aS->S(S)S|εS->aSbS|bSaS|ε⧗S->a|S+S|SS|S*|(S)answerL={0n1n|n>=1}L={Prefixexpressionconsistingofplusandminussigns}L={Matchedbracketsofarbitraryarrangementandnesting,includesε}L={Stringhasthesameamountofaandb,includesε}?2.2.3WhichofthegrammarsinExercise2.2.2areambiguousanswerNoNoYesYesYes2.2.4Constructunambiguouscontext-freegrammarsforeachofthefollowinglanguages.Ineachcaseshowthatyourgrammariscorrect.Arithmeticexpressionsinpostfixnotation.Left-associativelistsofidentifiersseparatedbycommas.Right-associativelistsofidentifiersseparatedbycommas.Arithmeticexpressionsofintegersandidentifierswiththefourbinaryoperators+,-,*,/.answer1.E->EEop|num2.list->list,id|id3.list->id,list|id4.expr->expr+term|expr-term|termterm->term*factor|term/factor|factorfactor->id|num|(expr)5.expr->expr+term|expr-term|termterm->term*unary|term/unary|unaryunary->+factor|-factorfactor->id|num|(expr)2.2.5Showthatallbinarystringsgeneratedbythefollowinggrammarhavevaluesdivisibleby3.Hint.Useinductiononthenumberofnodesinaparsetree.num->11|1001|num0|numnumDoesthegrammargenerateallbinarystringswithvaluesdivisibleby3?answerproveanystringderivedfromthegrammarcanbeconsideredtobeasequenceconsistingof11,1001and0,andnotprefixedwith0.thesumofthisstringis:sum=Σn(21+20)*2n+Σm(23+20)*2m=Σn3*2n+Σm9*2mItisobviouslycandivisibleby3.No.Considerstring"10101",itisdivisibleby3,butcannotderivedfromthegrammar.Question:anygeneralprove?2.2.6Constructacontext-freegrammarforromannumerals.Note:wejustconsiderasubsetofromannumeralswhichislessthan4k.answerwikipedia:Roman_numeralsviawikipedia,wecancategorizethesinglenomannumeralsinto4groups:I,II,III|IV|V,VI,VII,VIII|IXthengettheproduction:digit->smallDigit|IV|VsmallDigit|IXsmallDigit->I|II|III|εandwecanfindasimplewaytomapromantoarabicnumerals.Forexample:XII=>X,II=>10+2=>12CXCIX=>C,XC,IX=>100+90+9=>199MDCCCLXXX=>M,DCCC,LXXX=>1000+800+80=>1880viatheuppertworules,wecanderivetheproduction:romanNum->thousandhundredtendigitthousand->M|MM|MMM|εhundred->smallHundred|CD|DsmallHundred|CMsmallHundred->C|CC|CCC|εten->smallTen|XL|LsmallTen|XCsmallTen->X|XX|XXX|εdigit->smallDigit|IV|VsmallDigit|IXsmallDigit->I|II|III|ε2.3ExercisesforSection2.32.3.1Constructasyntax-directedtranslationschemethattrans­latesarithmeticexpressionsfrominfixnotationintoprefixnotationinwhichanoperatorappearsbeforeitsoperands;e.g.,-xyistheprefixnotationforx-y.Giveannotatedparsetreesfortheinputs9-5+2and9-5*2.。
answerproductions:expr->expr+term|expr-term|termterm->term*factor|term/factor|factorfactor->digit|(expr)translationschemes:expr->{print("+")}expr+term|{print("-")}expr-term|termterm->{print("*")}term*factor|{print("/")}term/factor|factorfactor->digit{print(digit)}|(expr)2.3.2Constructasyntax-directedtranslationschemethattrans­latesarithmeticexpressionsfrompostfixnotationintoinfixnotation.Giveannotatedparsetreesfortheinputs95-2*and952*-.answerproductions:expr->exprexpr+|exprexpr-|exprexpr*|exprexpr/|digittranslationschemes:expr->expr{print("+")}expr+|expr{print("-")}expr-|{print("(")}expr{print(")*(")}expr{print(")")}*|{print("(")}expr{print(")/(")}expr{print(")")}/|digit{print(digit)}AnotherreferenceanswerE->{print("(")}E{print(op)}E{print(")"}}op|digit{print(digit)}2.3.3Constructasyntax-directedtranslationschemethattrans­latesintegersintoromannumeralsanswerassistantfunction:repeat(sign,times)//repeat('a',2)='aa'translationschemes:num->thousandhundredtendigit{num.roman=thousand.roman||hundred.roman||ten.roman||digit.roman;print(num.roman)}thousand->low{thousand.roman=repeat('M',low.v)}hundred->low{hundred.roman=repeat('C',low.v)}|4{hundred.roman='CD'}|high{hundred.roman='D'||repeat('X',high.v-5)}|9{hundred.roman='CM'}ten->low{ten.roman=repeat('X',low.v)}|4{ten.roman='XL'}|high{ten.roman='L'||repeat('X',high.v-5)}|9{ten.roman='XC'}digit->low{digit.roman=repeat('I',low.v)}|4{digit.roman='IV'}|high{digit.roman='V'||repeat('I',high.v-5)}|9{digit.roman='IX'}low->0{low.v=0}|1{low.v=1}|2{low.v=2}|3{low.v=3}high->5{high.v=5}|6{high.v=6}|7{high.v=7}|8{high.v=8}2.3.4Constructasyntax-directedtranslationschemethattrans­latesromannumeralsintointegers.answerproductions:romanNum->thousandhundredtendigitthousand->M|MM|MMM|εhundred->smallHundred|CD|DsmallHundred|CMsmallHundred->C|CC|CCC|εten->smallTen|XL|LsmallTen|XCsmallTen->X|XX|XXX|εdigit->smallDigit|IV|VsmallDigit|IXsmallDigit->I|II|III|εtranslationschemes:romanNum->thousandhundredtendigit{romanNum.v=thousand.v||hundred.v||ten.v||digit.v;print(romanNun.v)}thousand->M{thousand.v=1}|MM{thousand.v=2}|MMM{thousand.v=3}|ε{thousand.v=0}hundred->smallHundred{hundred.v=smallHundred.v}|CD{hundred.v=smallHundred.v}|DsmallHundred{hundred.v=5+smallHundred.v}|CM{hundred.v=9}smallHundred->C{smallHundred.v=1}|CC{smallHundred.v=2}|CCC{smallHundred.v=3}|ε{hundred.v=0}ten->smallTen{ten.v=smallTen.v}|XL{ten.v=4}|LsmallTen{ten.v=5+smallTen.v}|XC{ten.v=9}smallTen->X{smallTen.v=1}|XX{smallTen.v=2}|XXX{smallTen.v=3}|ε{smallTen.v=0}digit->smallDigit{digit.v=smallDigit.v}|IV{digit.v=4}|VsmallDigit{digit.v=5+smallDigit.v}|IX{digit.v=9}smallDigit->I{smallDigit.v=1}|II{smallDigit.v=2}|III{smallDigit.v=3}|ε{smallDigit.v=0}2.3.5Constructasyntax-directedtranslationschemethattrans­latespostfixarithmeticexpressionsintoequivalentprefixarithmeticexpressions.answerproduction:expr->exprexprop|digittranslationscheme:expr->{print(op)}exprexprop|digit{print(digit)}ExercisesforSection2.42.4.1Constructrecursive-descentparsers,startingwiththefollow­inggrammars:S->+SS|-SS|aS->S(S)S|εS->0S1|01Answer1)S->+SS|-SS|avoidS(){switch(lookahead){case"+":match("+");S();S();break;case"-":match("-");S();S();break;case"a":match("a");break;default:thrownewSyntaxException();}}voidmatch(Terminalt){if(lookahead=t){lookahead=nextTerminal();}else{thrownewSyntaxException()}}2)S->S(S)S|εvoidS(){if(lookahead=="("){S();match("(");S();match(")");S();}}3)S->0S1|01voidS(){switch(lookahead){case"0":match("0");S();match("1");break;case"1"://match(epsilon);break;default:thrownewSyntaxException();}}ExercisesforSection2.62.6.1ExtendthelexicalanalyzerinSection2.6.5toremovecom­ments,definedasfollows:Acommentbeginswith//andincludesallcharactersuntiltheendofthatline.Acommentbeginswith/*andincludesallcharactersthroughthenextoccurrenceofthecharactersequence*/.2.6.2ExtendthelexicalanalyzerinSection2.6.5torecognizetherelationaloperators.2.6.3ExtendthelexicalanalyzerinSection2.6.5torecognizefloat­ingpointnumberssuchas2.,3.14,and.5.AnswerSourcecode:commit8dd1a9aCodesnippet(src/lexer/Lexer.java):publicTokenscan()throwsIOException,SyntaxException{for(;;peek=(char)stream.read()){if(peek==''||peek=='\t'){continue;}elseif(peek=='\n'){line=line+1;}else{break;}}//handlecommentif(peek=='/'){peek=(char)stream.read();if(peek=='/'){//singlelinecommentfor(;;peek=(char)stream.read()){if(peek=='\n'){break;}}}elseif(peek=='*'){//blockcommentcharprevPeek='';for(;;prevPeek=peek,peek=(char)stream.read()){if(prevPeek=='*'&&peek=='/'){break;}}}else{thrownewSyntaxException();}}//handlerelationsignif("".indexOf(peek)>-1){StringBufferb=newStringBuffer();b.append(peek);peek=(char)stream.read();if(peek=='='){b.append(peek);}returnnewRel(b.toString());}//handlenumber,notypesensitiveif(Character.isDigit(peek)||peek=='.'){BooleanisDotExist=false;StringBufferb=newStringBuffer();do{if(peek=='.'){isDotExist=true;}b.append(peek);peek=(char)stream.read();}while(isDotExist==true?Character.isDigit(peek):Character.isDigit(peek)||peek=='.');returnnewNum(newFloat(b.toString()));}//handlewordif(Character.isLetter(peek)){StringBufferb=newStringBuffer();do{b.append(peek);peek=(char)stream.read();}while(Character.isLetterOrDigit(peek));Strings=b.toString();Wordw=words.get(s);if(w==null){w=newWord(Tag.ID,s);words.put(s,w);}returnw;}Tokent=newToken(peek);peek='';returnt;}ExercisesforSection2.82.8.1For-statementsinCandJavahavetheform:for(exprl;expr2;expr3)stmtThefirstexpressionisexecutedbeforetheloop;itistypicallyusedforinitializ­ingtheloopindex.Thesecondexpressionisatestmadebeforeeachiterationoftheloop;theloopisexitediftheexpressionbecomesO.Theloopitselfcanbethoughtofasthestatement{stmtexpr3;}.Thethirdexpressionisexecutedattheendofeachiteration;itistypicallyusedtoincrementtheloopindex.Themeaningofthefor-statementissimilartoexpr1;while(expr2){stmtexpr3;}DefineaclassForforfor-statements,similartoclassIfinFig.2.43.AnswerclassForextendsStmt{ExprE1;ExprE2;ExprE3;StmtS;publicFor(Exprexpr1,Exprexpr2,Exprexpr3,Stmtstmt){E1=expr1;E2=expr2;E3=expr3;S=stmt;}publicvoidgen(){E1.gen();Labelstart=newLable();Lalelend=newLable();emit("ifFalse"+E2.rvalue().toString()+"goto"+end);S.gen();E3.gen();emit("goto"+start);emit(end+":")}}2.8.2TheprogramminglanguageCdoesnothaveabooleantype.ShowhowaCcompilermighttranslateanif-statementintothree-addresscode.AnswerReplaceemit("isFalse"+E.rvalue().toString()+"goto"+after);withemit("ifNotEqual"+E.rvalue().toString()+"0goto"+after);oremit("isNotEqualZero"+E.rvalue().toString()+"goto"+after);
2025/11/27 8:37:48 658KB 龙书答案 完整性高
1
笔者曾混迹过各种攻防演练活动,参与过防守方、攻击方,也算是大概了解了每一个队伍的任务~参加防守时印象尤为深刻,也跟一起防守的“战友”做过有趣的事情,例如:反打攻击队;
题外话说的有点多了,来说说为什么开发这样一个平台:作为一个防守方光看日志固然是枯燥无味的,偶尔来几次反向打击啥的,增添防守的乐趣~所以我想到了做这样一个系统,就是想在“空暇”时间能获取点“黑客攻击者”的“画像”。
本平台采用被动式的方式分析黑客攻击者画像,可扩展赋能蜜罐以及安全设备,将平台接口部署在蜜罐Web界面上即可,当攻击者访问所部署的Web界面即触发平台分析功能,对访问者进行分析,数据回传平台分析其网络身份、IP、IP定位:物理地址等信息。
AHRID信息展示平台支持接口授权的方式授权站点,已授权站点才可使用平台接口进行被动式的攻击者画像分析以及数据回传。
AHRID接口授权平台的分析功能采用模块化设计,可针对不同的分析功能新建不同的分析模块进而让平台的分析功能更加丰富完善(开源版本目前只支持JSONP探针模块)AHRID提交模块AHRID开源版使用授权使用登录进AHRID平台之后需要先添加接口授权:AHRID接口授权当添加完毕后,复制接口代码至蜜罐页面或需监测的页面中即可(建议复制到最后),这样就已经部署成功了,只需要等待攻击者触发数据回传功能,等待画像信息即可。
模块提交当已经发现一个JSONP劫持漏洞时,即可提交到AHRID平台上:JSONP劫持漏洞漏洞地址:http://my.website/dorabox/csrf/jsonp.php?callback=test要获取的信息:username模块提交说明:1.名字模块名字(建议使用英文)2.SRC存在JSONP劫持漏洞的URL地址3.回调参数值回调参数的值(参数=值)4.数据字段JSON字段(例如:{"username":"123"},要获取的是username即填写username;
例如:{"data":{"uid":"123"}},要获取的是uid即填写data.uid)5.信息展示地址一般填写无或者随意填写6.模块描述根据模块功能说明AHRID模块提交示例AHRID开源版设计概述当攻击者访问到部署了AHRID接口的页面,即触发JSONP探针获取攻击者已登录状态下的登录信息,回传登录信息+IP+UA,后端会对IP进行物理地址转换,最终将数据记录到数据库。
数据库结构表:Admin-列:id,username,password表:Hackinfo-列:hid,host,ip,user_agent,jsondata,creaye_time,times表:Plugins-列:pid,name,src,callback,columns,url,commit表:Apis-列:aid,hostIP地址转换依赖:GeoLite2-City.mmdbIP定位依赖:接口apis.map.qq.com、way.jd.com+取中心点依赖环境:Python2+Flask+Mysql所需网络环境:互联网(可出网)AHRID开源版搭建1.config.py配置文件修改需要配置的信息如下:USERNAME:Mysql用户名PASSWORD:Mysql用户密码HOST:Mysql主机地址PORT:Mysql端口SECRET_KEY:SESSION秘钥(建议16位以上随机英文字母+数字+特殊符号)TX_KEYS:腾讯接口KEYS(2个以上,参考:https://lbs.qq.com/webservice_v1/guide-ip.html)JCLOUD_KEY:京东云接口KEY(Github可白嫖)2.Mysql创建“ahrid”数据库3.执行如下代码pythonmanage.pydbinitpythonmanage.pydbmigrate4.启动服务:sudopythonapp.py默认端口为:80,可自行修改app.py文件如下代码部分server=pywsgi.WSGIServer(('0.0.0.0',80),app)
2025/10/29 11:37:37 57.82MB 威胁情报 黑产对抗 网络安全 信息安全
1
intmain(void){u16t;u16len;u16times=0;delay_init();//延时函数初始化NVIC_PriorityGroupConfig(NVIC_PriorityGroup_2);//设置NVIC中断分组2:2位抢占优先级,2位响应优先级uart_init(115200);//串口初始化为115200LED_Init();//LED端口初始化KEY_Init();//初始化与按键连接的硬件接口while(1){if(USART_RX_STA&0x8000;){len=USART_RX_STA&0x3fff;//得到此次接收到的数据长度printf("\r\n您发送的消息为:\r\n\r\n");for(t=0;t<len;t++){USART_SendData(USART1,USART_RX_BUF[t]);//向串口1发送数据while(USART_GetFlagStatus(USART1,USART_FLAG_TC)!=SET);//等待发送结束}printf("\r\n\r\n");//插入换行USART_RX_STA=0;}else{times++;if(times0==0)printf("请输入数据,以回车键结束\n");if(times0==0)LED0=!LED0;//闪烁LED,提示系统正在运行.delay_ms(10);}}}
2023/12/16 20:02:36 1.99MB STM32 UART
1
为克服水声多途干扰影响,提出将差分跳频技术应用于水声通信,通过分析水声多途信道下差分跳频信号的特征,利用频率转移函数的隐含信息和水声信道的多途特征,优化了频率序列检测的Vitervi硬判决算法,并详细给出了算法流程.在含有加性高斯白噪声的多途信道下进行了仿真.结果表明,采用优化算法的系统功能得到显著提高,在频率检测差错率为10×10-3时,获得了近2.5dB的增益,表明差分跳频体制能有效克服多途干扰,适用于水声通信.
1
个人不在办公室的机器人松弛该漫游器会像您一样操作,并且在您离开时会通过一条消息回复DM和频道提及。
产品特点开始时间:设置开始时间,机器人会等到设置时间后才能收听和回复结束时间:设置结束时间,机器人将在设置的时间关闭当有人直接向您发送消息时,回复IM/多人IM回应直接提及您的频道(@username)响应其他关键字(例如“shaun,burdick”)提示缓冲区:在给定时间过去之前,Bot不会响应用户/频道(以防止垃圾邮件)自动标记:Bot可以将您所有的消息标记为已读可以将漫游器配置为在特定时间向特定频道的不在办公室用户宣告(您必须在该频道进行宣告)个人备用令牌您可以在此处生成您的个人Slack令牌::公告公告该漫游器可以按计划宣布哪些用户不在办公室。
要启用此功能,您需要向漫游器提供发布通知的频道列表以及发布的时间(漫游器本地)。
app.announce.channels:这是要向其宣布的频道名称的数组该漫游器必须是该频道的成员才能发布通知频道名称不得包含起始#app.announce.times:这是每天发布公告的时间
2018/2/5 18:10:16 71KB slack bot reminder office-bot
1
在日常工作中,钉钉打卡成了我生活中不可或缺的一部分。然而,有时候这个看似简单的任务却给我带来了不少烦恼。 每天早晚,我总是得牢记打开钉钉应用,点击"工作台",再找到"考勤打卡"进行签到。有时候因为工作忙碌,会忘记打卡,导致考勤异常,影响当月的工作评价。而且,由于我使用的是苹果手机,有时候系统更新后,钉钉的某些功能会出现异常,使得打卡变得更加麻烦。 另外,我的家人使用的是安卓手机,他们也经常抱怨钉钉打卡的繁琐。尤其是对于那些不太熟悉手机操作的长辈来说,每次打卡都是一次挑战。他们总是担心自己会操作失误,导致打卡失败。 为了解决这些烦恼,我开始思考是否可以通过编写一个全自动化脚本来实现钉钉打卡。经过一段时间的摸索和学习,我终于成功编写出了一个适用于苹果和安卓系统的钉钉打卡脚本。
2024-04-09 15:03 15KB 钉钉 钉钉打卡