我可以将发送给我的LAN消息放入程序中进行解密吗? [英] Can I take a LAN message sent to me and put it into a program to decrypt it?

查看:98
本文介绍了我可以将发送给我的LAN消息放入程序中进行解密吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经制作了一个简单的LAN Messenger,用于使用此批处理文件与网络上的人交谈:

I've made a simple LAN messenger for talking to people on my network using this batch file:

@ echo off
:A
 cls
echo MESSENGER
set /p n=User:
set /p m=Message:
set /p z=Time:
msg /SERVER:%n% * /TIME:%z% "%m%"
Pause
Goto A

我要做的是在使用算法将消息发送之前对其进行加密,然后在显示明文之前在接收方的一端解密该消息.

What I want to do is encrypt the message before it's sent with an algorithm and then decrypt the message on the recipient's end before the plaintext is displayed.

我已经上网了,关于接收和使用邮件的信息似乎很少.

I've looked online and there doesn't seem to be much information on taking received messages and using them.

推荐答案

快速解决方案.而不用退出CMD ...我将压缩发送的消息,然后在终点将其解压缩.在没有经验的用户看来,它看起来像是一条加密的消息.实际上只是添加了几行代码.然后您的代码将如下所示:

A quick sol. and without going out of CMD... I would compress the message send it and then decompress it at the end point. At the eyes of an inexperienced user could look like a ciphered message. Actually is just adding few lines of code. Then your code would look like:

@ echo off
setlocal EnableDelayedExpansion

:A
cls
echo MESSENGER

set /p n=User:
set /p m=Message: & echo !m! > ~
set /p z=Time:

makecab ~ > nul
set /p m=<~._
del /f ~
del /f ~._

msg /SERVER:%n% * /TIME:%z% "%m%"

Pause
Goto A

重要提示: :当前将~._重定向到m的操作无法正常进行.

Important: Currently redirecting the ~._ into m is not working properly.

输入:

This is a message

输出:

MSCF    \       ,               >              8O]z  ~ ╗+Å  CK╔╚,V óDà▄ÈÔÔ─¶T^.

在客户端,我们可以使用expand解压缩消息.我不知道msg命令的接收方式是如何工作的.但是我要假设它可以通过echo命令来描述.因此,

At the client-side we can use expand to decompress the message. I don't know how the recepcion of the msg command works. But i am going to assume that it can be depicted as by the echo command. Therefore,

REM substitute echo by the reception command.
echo !rcv_msg! > ~
expand ~ msg.temp
type msg.temp
del /f msg.temp

如果我们删除每次运行压缩后都会附加的MSCF字符,则将更加健壮.然后在将其解压缩之前,将它们附加在消息的开头.

It would more robust if we erase the MSCF characters which seems to be appended every time the compression is ran. And then append them at the beggining of the message before decompressing it.

这篇关于我可以将发送给我的LAN消息放入程序中进行解密吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆