How do viruses function from a programming point of view? [closed] - security

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
I have always been fascinated by computer viruses. For years I have tired to learn about them, but due to their nature people are unwilling to give many details.
For what it is worth I'm not a hacker and am not trying to build a virus.
If anyone is willing to answer this question I want to know what makes a virus a virus and how they are different from spyware.
How can they install themselves onto a computer without you noticing?
And how do worms work? How can a program replicate and move on its own? Does it contain its source code within it? And does it interface with other programs or just assess the hardware directly to spread ?
EDIT: What language would they be written in? Would you use assembly/C++ types of languages or create them as scripts in lua?

Well, a worm is simply a self-replicating piece of software. Imagine a program that copies its executeable over some link to another computer and launches it there. That's not that much magic.
A virus is simply a worm which infects other executeables, i.e. it does not replicate its own image, but it "backpacks" it to a different application's image and uses that application's execution flow to get initiated.
The user does not notice anything if there are no side-effects, and no UI interaction.
If the user is a technically more competent than the average end-user, this is very hard to achieve. Some malwares host the target system in a virtual machine so you as the user have a hard time to see anything suspicious as long as you don't figure you look at a virtual machine. Like Neo, awaking from the Matrix.
As there is no limit to what you can implement in what language, there is no language of choice. Naturally, a low-level and natively-compiled language is more versatile to do what a virus/worm must do to stay low-profile. However, there are worms and viruses written in assembly language, Basic, C, Delphi, JavaScript, whatever -- there is nothing you can not imagine here.
Spyware has similar requirements, but different goals. While a virus, and a worm, usually spreads around, either for no reason or to drop some kind of payload at some point, spyware wants to either "phone home" or open the target system so it can be attacked, i.e. inspected, easier, usually in order to get hold of a victim's data that is secret, personal, or otherwise interesting.
Hope this quick answer helps a bit. You can google more details easily at bing :)

Related

Using the Linux kernel in my operating system [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about programming within the scope defined in the help center.
Closed 4 years ago.
Improve this question
PREFACE
I tried to put as much effort and work into this question as I reasonably could, so if you could at least read it through, I would highly appreciate it; I, also, have tried researching this question, but I never seemed to find anything useful, in terms of anything that directly answered my question; I do not know if this is right place for this question, even though it is related to programming, it is more related to operating system development and the Linux kernel, and if there is a better place for this question that I am unaware of, please move it there; feel free to do whatever, edit the question if need be, I do not care, I just need an answer to this question, because this is stressing me out.
The following is some background on why I am asking this question; if you are uninterested, and if you just want to see what I am asking, then skip to the 'MY QUESTION' label; I thought that I would put this is here, so that anyone who is reading this question would know why I am asking this question.
BACKGROUND
I have recently begun setting up an operating system development project; and after I get some things ready, it will be only me working on it, as of right now, and I plan to write the whole thing (yes, I know it will take a whole lot of work, but I can try, right? :p), including the bootstrapping, the CLI, and most of what is necessary to have to either my own kernel or Linux kernel function; GUI and much more; granted, eventually I may end up having a team, but that is for the future.
MY QUESTION
My question, which is actually consists of three parts, and I narrowed them down to specifically those thee things, which are the following:
(1) If I were to build everything else, and use the Linux kernel as-is, and if I were to not tie the other parts of the system into the kernel, but use the kernel for I/O and system calls, would I be violating the GPL in any way, and would I think need to open source the rest of my code?
(2) If I were to only use the kernel for I/O and for system calls, but not have the code that I wrote actually interface with any kernel functions, would that still be considered linking?
(3) If I were to do the above, would that be considered a derived work, when I wrote everything else, but used Linux as the system's kernel?
All these legal issues are making my head spin and extremely confusing to me.
No
No
No
The linux kernel considers the system calls a boundary, and code that communicates with the kernel via system calls is not covered by the licensing of the kernel. So, the user space code you write is not a derivative work of the kernel.
There's also a set of header files provided by the kernel, collectively named the UAPI headers which you can use without having your code become a derivative work
This is covered at https://www.kernel.org/doc/html/v4.17/process/license-rules.html and https://github.com/torvalds/linux/blob/master/LICENSES/exceptions/Linux-syscall-note
If you need legal advice though, contact a lawyer.

In embedded design, what is the actual overhead of using a linux os vs programming directly against the cpu? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 9 years ago.
Improve this question
I understand that the answer to this question, like most, is "it depends", but what I am looking for is not so much an answer as much as a rationale for the different things affecting the decision.
My use case is that I have an ARM Cortex A8 (TI AM335x) running an embedded device. My options are to use some embedded linux to take advantage of some prebuilt drivers and other things to make development faster, but my biggest concern for this project is the speed of the device. Memory and disk space are not much of a concern. I think it is a safe assumption that programming directly against the mpu and not using a full OS would certainly make the application faster, but gaining a 1 or 2 percent speedup is not worth the extra development time.
I imagine that the largest slowdowns are going to come from the kernel context switching and memory mapping but I do not have the knowledge to correctly assess or gauge the extent of those slowdowns. Any guidance would be greatly appreciated!
Your concerns are reasonable. Going bare metal can/will improve performance but it may only be a few percent improvement..."it depends".
Going bare metal for something that has fully functional drivers in linux but no fully functional drivers bare metal, will cost you development and possibly maintenance time, is it worth that to get the performance gain?
You have to ask yourself as well am I using the right platform, and/or am I using the right approach for whatever it is you want to do on that processor that you think or know is too slow. Are you sure you know where the bottleneck is? Are you sure your optimization is in the right place?
You have not provided any info that would give us a gut feel, so you have to go on your gut feel as to what path to take. A different embedded platform (pros and cons), bare metal or operating system. Linux or rtos or other. One programming language vs another, one peripheral vs another, and so on and so on. You wont actually know until you try each of these paths, but that can be and likely is cost and time prohibitive...
As far as the generic title question of os vs bare metal, the answer is "it depends". The differences can swing widely, from almost the same to hundreds to thousands of times faster on bare metal. But for any particular application/task/algorithm...it depends.

Garble every third line of code, using Vim, before sending to a prospective client? [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
I have a specific problem. I want to sell one of my models, programmed in the R programming language. I want to show the prospective client that there is a lot of advanced work in the code, and there is a lot of it, representing about 700 hours of R&D (around 2000 lines of R code). So, I want to send him the code. To impress him.
However I obviously don't want to disclose the full workings of the code, so I was thinking of garbling every third or fourth line, so that it cannot simply be OCR'd and replicated. I don't want to go down the NDA route, nor is the client adept at programming (wouldn't be able to replicate it himself - though could hire a programmer I guess). I'd also probably garble completely one or two key functions.
How would I do this in Vi / Vim?
Is there any other way of solving my issue that someone could suggest?
Yes I know I could show him the output of the program as the sales pitch, which I have already done, but we're haggling on pricing so a bit of "blinding with science" through a code listing, to see how much work is involved, won't hurt. It is my experience that many non-programmers have no idea of how much work can go into a piece of software.
You should move/repost your question to programmers.stackexchange.com, it seems more fitting.
However, I think that if you are trying to sell something to someone non technical, showing the code won't work. Typing 2000 line of code is not that long. He/She won't be able to gauge the value by reading some incomprehensible symbols.
Rather you should show the added value of your code for his/her business. So get a set of data (potentially from your customer), and extracting/showing relevant information from that set should be more impressive. I should add that the price of your model does not only depend of the work involved, but also from the potential benefits for you customer.
A piece of code is only solving a problem, you can probably sell it from 10$ to 100 millions $ depending on the problem solved.
I fully back the points brought up by Xavier T., but if you still think you need to show some representation of the full body of code to make an impression about the amount of your work, I'd either:
Create a printout with a very small font just to get the structure across (e.g. :set printfont=Courier_h4); obviously, this only works for paper copies, not PDFs.
Obfuscate by replacing all alphabetic letters with x, as in :%substitute/\a/x/g

How to design a project ( detail ) ?? indetail [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 3 years ago.
Improve this question
My question is really very important .
When i program i have seen that i had lots of errors in programming logic + structure + a flexible when it goes for testing , i have read many books on OOPS and my all the concept are clear but i do not know where to start design of my code or project . can any body help me how to improve this part of programming skill.
although i work on php+javascript but this question is for all the programmers on stackoverflow
note- usually when i hold paper and pen i think where to start from ..
if i make something problem is how to simplyfy.... and many others which u all are facing / faced
Well, I think everyone is different as is every project. But here is what I personally do...
For my own projects, i.e. no client requirements, I start at one end or the other, either with the database structure or the UI. I then work down through the layers making sure that I maintain clear separation of concerns to make testing (unit and system) as well as maintenance as easy as possible.
One thing to note is that regardless of your approach I think the process is iterative. I will often work, refactor, work, refactor etc so don't get too bogged down with the details and feel you have to stick to them. The requirements are the key thing (whether for yourself or for a client), the technical implementation is largely irrespective.
When dealing with clients the process is somewhat different. You will need to do a fair amount of design up front so again think from one layer to the next trying to keep as much of the logic in the correct layers as possible. As an example you have your DB, then you want a data access layer (DAL) to abstract your code from the DB access. Then you want specific business logic libraries which use the DAL, this abstracts the higher portions of code from the data (they go through the business layer) etc etc.
Just think of each level and try and keep it as generic as possible, that way when you wish to change the storage for the data, you simply change the DAL and everything else works as before...
As far as starting a design of your project is concerned, whole lot depends on what you are developing, that is requirement of the application. So first thing is that you must collect information about the purpose of your application. And when we start to program, a plain trend must be kept in mind, which is, as a universal fact of programming, Input-Process-Output. So, design starts with input. Just collect as much information as you can about what will be required as your input of application. If the input is not made by your user, than it is not required to be mentioned in your front-end design (In Windows language, the so called "Form"). What user will give, is matter of concern in designing the input area (very first step to start project).
During the designing phase, constant interaction is required with user to make effective & flexible start design, as ultimately he/she is going to use. If I'm starting a project's designing, I always consider the user a lazy person, if we keep that thing in mind, our application will be simpler & easy to use. Once, you'll kick-off the start, its just a flow, that'll suggest you next step.
Hope this helps............. :-)

Should programmers be domain experts? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 6 years ago.
Improve this question
What, in your opinion (although I would highly appreciate articles / books on related issues), should be the the level of the programmers knowledge of the domain?
(This related question didn't quite answer my question / had a reference to something I can use)
If programmers were domain experts, they would not be programmers. :-)
For example, I do a lot of software development for archaeologists. If I knew as much about archaeology as the users I work for, I would be digging and surveying in the field rather than programming. Which makes no sense.
Having said this, I think that programmers need to be knowledgeable about the domain, and as much as possible, but without losing track of priorities.
If you need domain expertise, bring a domain expert into the team.
Yes and no.
As Kyle pointed out, programmers are often changing domains on every project and this pretty much precludes you becoming an "expert" in any given domain. On the other hand, you need to understand the problem well enough to a) craft a solution, and b) test that it actually solves the problem at hand.
One reason for not claiming domain knowledge is so that your customers are forced to take ownership of this part of the project. The best way I have fouond of forcing them is to require a clear overall description of the project (no more than a couple pages long) plus a ton of User Stories ... written by the users. You can lead them through the process of how to write US's, but they will not truly own the end solution unless they were intimately involved in creating it.
Having US's and using them both for design and testing puts project ownership where it ultimately belongs -- in the hands of the users of the system.
As a consultant I am constantly (every 6 to 12 months) changing domains. Though I can never proclaim to be a true expert by the time I finish a project, the more domain knowledge I acquire, the more value I can add the project.
If you don't understand the problem domain, you shouldn't be coding a solution.
You don't have to be an expert, but you cannot be ignorant of the key ideas.
As a FORTRAN expert, you won't make any progress coding an FFT unless you have
some background in signal processing, and understand why an FFT is necessary,
and know a variety of implementations.
That depends on how related to the domain the specific job they're doing is. In team context, I can imagine that the lead programmer and some others benefit from a bit of domain knowledge while others in the team don't need it.
Banking/financial applications
Networking/wireless/telecom
Mobile Applications
Web/storage/enterprise/Numerous others..
If by "domain" you mean your area of work, yes you should strive to understand everything related to your area of work. How far into other areas that extends is another question.
programmer is like people who can interface "other people" with computer by creating software, and better understanding of the domain where you're working for would help the communication between the problem and the "other people" thus would make you a better programmer.
but the problem domain is often very wide and deep, you can expect everyone to be expert at programming and expert at another field, for example you can expect great scientist or physicians to be expert at programming to solve his problem when creating space-ship because programming is not his main concern, so with programmer, but programmer or scientist who can talk to each other is the best fit
Even if you change projects and with them domains frequently, domain specific know how and experience in one sector (or branch of trade) will be always a plus.
I look at this as "WHAT" versus "WHY". As in What is the business requirement versus Why is the requirement such as it is. A junior programmer only needs to understand the WHATs of a project. An analyst needs to understand both. In my opinion and my professional status, to stop being a developer and to become a software engineer, you need to add analyst to your skill set.

Resources