一个c++的project。。实在没什么头绪了,还请大佬帮忙看一下!一经采纳50话费。加q634
For this project we are going to be working with arrays, pointers and structs. Additionally, we'll be working on the some basics of cybersecurity. We will be working with electronic communication and making sure the messages we receive are authentic and haven't been tampered with.
Details
For this project we will once again have a command file. The command file will have a series of commands that instruct our program what to do. The commands will be described below. The commands will deal with messages and we will be using an mbox format. Now there are at least 3-5 different mbox formats and so we'll be using a simplified version of this and I'll describe it below. The heart of this project will be a struct that you create and then 2 arrays used to store the messages. One of the arrays will store valid or good messages, and the other array will store hacked or invalid messages. Both of these arrays will need to "grow" and so we'll be using pointers and dynamic arrays to accomplish this.
Input
For this project the mailbox program will respond to a series of commands:
load this command will expect a filename to appear after it. The file will be a valid mbox file and the messages will not be checked as they are loaded. (Even though some of them may be hacked, load will put them all in the inbox.)
add this command will simulate a new message coming in. On the next line will be a single message. The message will need to be checked for validity. If it is good, then it is added to the inbox. Otherwise it is added to the hacked message inbox or list.
show this command will be followed by which inbox to show, i.e inbox or hacked, and then optionally a number. If the command is just show inbox or show hacked then the entire request list of messages will be shown. If the command is ended with a number then, if the number is good, that message is shown. IF the message number is invalid, then an error message is shown.
remove this command will be followed by which inbox you wish to remove a message from and then it will end with a message number. This would look something like this: remove inbox 3 or remove hacked 2 If the message number is valid, then the message is removed from the list and an output would indicate it's removal. If the message number is invalid then an error output is displayed.
save this command will be followed by which inbox to save and a filename where to save the inbox. For example: save inbox mboxsave or save hacked mboxhackedsave The format of the saved file is such that it could be used to load. So to test, you could add some messages, save your inbox, then load that same saved file back in.
mbox file
mbox files in general come in many flavors and varieties. I've decided to simplify the format for our purposes but it is similar to what is actually used. The messages will all be stored in the following format
From <email address>Date <date>To <email address>Subject <subject>Message<message body>ID <id number><blank line>
The words that are not in the < > will be actual words in the file. You may use those to identify the parts of the message. The message will always come in that order. The parts in the < > will change and what is used to generate the ID. The word Message will always be on a line by itself and the following message will be a single line of text, i.e. you may use getline to read it. The ID is a signed hash. This will be explained in greater detail below, but it is what we will be using to make sure that any incoming messages haven't been tampered with. If the ID in the message doesn't match the ID that we compute when we receive the message, then the assumption is the message was tampered with in transmission and should not be trusted.
For this project we are going to be working with arrays, pointers and structs. Additionally, we'll be working on the some basics of cybersecurity. We will be working with electronic communication and making sure the messages we receive are authentic and haven't been tampered with.
Details
For this project we will once again have a command file. The command file will have a series of commands that instruct our program what to do. The commands will be described below. The commands will deal with messages and we will be using an mbox format. Now there are at least 3-5 different mbox formats and so we'll be using a simplified version of this and I'll describe it below. The heart of this project will be a struct that you create and then 2 arrays used to store the messages. One of the arrays will store valid or good messages, and the other array will store hacked or invalid messages. Both of these arrays will need to "grow" and so we'll be using pointers and dynamic arrays to accomplish this.
Input
For this project the mailbox program will respond to a series of commands:
load this command will expect a filename to appear after it. The file will be a valid mbox file and the messages will not be checked as they are loaded. (Even though some of them may be hacked, load will put them all in the inbox.)
add this command will simulate a new message coming in. On the next line will be a single message. The message will need to be checked for validity. If it is good, then it is added to the inbox. Otherwise it is added to the hacked message inbox or list.
show this command will be followed by which inbox to show, i.e inbox or hacked, and then optionally a number. If the command is just show inbox or show hacked then the entire request list of messages will be shown. If the command is ended with a number then, if the number is good, that message is shown. IF the message number is invalid, then an error message is shown.
remove this command will be followed by which inbox you wish to remove a message from and then it will end with a message number. This would look something like this: remove inbox 3 or remove hacked 2 If the message number is valid, then the message is removed from the list and an output would indicate it's removal. If the message number is invalid then an error output is displayed.
save this command will be followed by which inbox to save and a filename where to save the inbox. For example: save inbox mboxsave or save hacked mboxhackedsave The format of the saved file is such that it could be used to load. So to test, you could add some messages, save your inbox, then load that same saved file back in.
mbox file
mbox files in general come in many flavors and varieties. I've decided to simplify the format for our purposes but it is similar to what is actually used. The messages will all be stored in the following format
From <email address>Date <date>To <email address>Subject <subject>Message<message body>ID <id number><blank line>
The words that are not in the < > will be actual words in the file. You may use those to identify the parts of the message. The message will always come in that order. The parts in the < > will change and what is used to generate the ID. The word Message will always be on a line by itself and the following message will be a single line of text, i.e. you may use getline to read it. The ID is a signed hash. This will be explained in greater detail below, but it is what we will be using to make sure that any incoming messages haven't been tampered with. If the ID in the message doesn't match the ID that we compute when we receive the message, then the assumption is the message was tampered with in transmission and should not be trusted.