kandi X-RAY | Exploit Summary
kandi X-RAY | Exploit Summary
Exploit
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- Upload a new ssh shell to the host
- Get current work path
- Get new work path
- Set new upload path
Exploit Key Features
Exploit Examples and Code Snippets
Community Discussions
Trending Discussions on Exploit
QUESTION
I create a Pentest tool for educational purposes, so the old version was written using python 2, then I convert it to python 3 and when I try to run the main file pxxtf.py
I got multiple errors, I correct most of them but for this one about Circular Import, I try multiple fixes from forums and StackOverFlow and nothing work with me.
When I try to run the main script :
...ANSWER
Answered 2021-Jun-15 at 14:05The error message is saying it all: "most likely due to a circular import".
pxxtf.py
QUESTION
I am trying to run a simple parallel program on a SLURM cluster (4x raspberry Pi 3) but I have no success. I have been reading about it, but I just cannot get it to work. The problem is as follows:
I have a Python program named remove_duplicates_in_scraped_data.py. This program is executed on a single node (node=1xraspberry pi) and inside the program there is a multiprocessing loop section that looks something like:
...ANSWER
Answered 2021-Jun-15 at 06:17Pythons multiprocessing package is limited to shared memory parallelization. It spawns new processes that all have access to the main memory of a single machine.
You cannot simply scale out such a software onto multiple nodes. As the different machines do not have a shared memory that they can access.
To run your program on multiple nodes at once, you should have a look into MPI (Message Passing Interface). There is also a python package for that.
Depending on your task, it may also be suitable to run the program 4 times (so one job per node) and have it work on a subset of the data. It is often the simpler approach, but not always possible.
QUESTION
I am looking for an application or a tool which is able for example to extract data from a 2D contour plot like below :
I have seen https://dash-gallery.plotly.host/Portal/ tool or https://plotly.com/dash/ , https://automeris.io/ , but I have test them and this is difficult to extract data (here actually, the data are covariance matrices with ellipses, but I would like to extend it if possible to Markov chains).
If someone could know if there are more efficient tools, mostly from this kind of 2D plot. I am also opened to commercial applications. I am on MacOS 11.3.
If I am not on the right forum, please let me know it.
UPDATE 1:
I tried to apply the method in Matlab with the script below from this previous post :
...ANSWER
Answered 2021-Jun-12 at 23:37Restating the problem - My understanding given the different comments and your updates is the following:
- someone other than you is in possession of data, which as it happens is 2D data, i.e. an Nx2 matrix;
- using the covariance matrix, they are effectively saying something about the joint distribution of these two dimensions, specifically about the variance;
- if they assume a Gaussian distribution, as is implied by your comment regarding 68%, 95% and 99.7% for 1sigma, 2sigma and 3sigma, they can draw ellipses which represent the 2D-normal distribution: these are in fact some of the contour lines associated with the 3D "bell" surface;
- you have obtained the contour lines in a graph and are trying to obtain the covariance matrix (not the original data...);
- you are concerned about the complexity of having to extract the information from each ellipsis.
Partial answer:
- It is impossible to recover the original data, I hope you are already aware of that, but in case you are not let's just note that the covariance matrix is a summary statistic of the data, much like the average, and although it says something about the data many different datasets could happen to have the same summary statistic (the same way many different sets of numbers can give you an average of 10).
- It is possible to somewhat recover the covariance matrix, i.e. the 3 numbers a, b and c in the matrix [a,b;b,c], though the error in doing so will likely be large because of how imprecise the pixel representation is. Essentially, you will be looking for the dimensions of the two axes, for the variances, as well as the angle of one of the axes, for the covariance.
- Unless I am mistaken, under the Gaussian assumption above, you only need to measure this for one of the three ellipses, and then factor by whatever number of sigmas that contour represents. Here you might want to either use the best-defined ellipse, or attempt to use the largest one, which will provide the maximum precision for your measurements (cf. pixelization).
- Also, the problem of finding the axes and angle for the ellipse need not be as complex as what it seems like in your first trials: instead of trying to find the contour of the ellipses, find the bounding rectangle.
- In order to further simplify this process, if your images are color-coded the way you show, then a filter on blue pixels might be enough in terms of image processing. Then simply take the minimum and maximum (x,y) coordinates in order to obtain the bounding rectangle.
- Once the bounding rectangle is obtained, find the equation to your ellipse (that's a question for a math group, but you could start here for example).
Happy filtering!
QUESTION
We have a code in production that in some situation may left-shift a 32-bit unsigned integer by more than 31 bits. I know this is considered undefined behavior. Unfortunately we can't fix this right now, but we can work this around, if only we can assume how it works in practice.
On x86/amd64 I know processor for shifts uses only the appropriate less-significant bits of the shift count operand. So that a << b
is in fact equivalent to a << (b & 31)
. From the hardware design this makes perfect sense.
My question is: how does this work in practice on modern popular platforms, such as arm, mips, RISC and etc. I mean those that are actually used in modern PCs and mobile devices, not outdated or esoteric.
Can we assume that those behave the same way?
EDIT:
The code I'm talking about currently runs in a blockchain. It's less important how exactly it works, but at the very least we want to be sure that it yields identical results on all the machines. This is the most important, otherwise this can be exploited to induce a so-called chain split.
Fixing this means hassles, because the fix should be applied simultaneously to all the running machines, otherwise we are yet again at risk of the chain split. But we will do this at some point in an organized (controlled) manner.
Lesser problem with the variety of compilers. We only use GCC. I looked at the code with my own eyes, there's a
shl
instruction there. Frankly I don't expect it to be anything different given the context (shift operand comes from arbitrary source, can't be predicted at compile time).Please don't remind me that I "can't assume". I know this. My question is 100% practical. As I said, I know that on x86/amd64 the 32-bit shift instruction only takes 5 least significant bits of the bit count operand.
How does this behave on current modern architectures? We can also restrict the question to little-endian processors.
...ANSWER
Answered 2021-Jun-02 at 20:15With code that triggers undefined behavior, the compiler can just about do anything - well, that's why it's undefined - asking for a safe definition of undefined code doesn't make any sense. Theoretical evaluations or observing the compiler translating similar code or assumptions on what "common practice" might be won't really give you an answer.
Evaluating what a compiler really has translated your UB code to would probably be your only safe bet. If you want to be really sure what happens in the corner cases, have a look at the generated (assembly or machine) code. Modern debuggers give you the toolset to catch those corner cases and tell you what actually happens (the generated machine code is, after all, very well defined). This will be much simpler and much safer than to speculate on what code the compiler might probably emit.
QUESTION
I have a concern in understanding the Cartpole code as an example for Deep Q Learning. The DQL Agent part of the code as follow:
...ANSWER
Answered 2021-May-31 at 22:21self.model.predict(state)
will return a tensor of shape of (1, 2) containing the estimated Q values for each action (in cartpole the action space is {0,1}).
As you know the Q value is a measure of the expected reward.
By setting self.model.predict(state)[0][action] = target
(where target is the expected sum of rewards) it is creating a target Q value on which to train the model. By then calling model.fit(state, train_target)
it is using the target Q value to train said model to approximate better Q values for each state.
I don't understand why you are saying that the loss becomes 0: the target is set to the discounted sum of rewards plus the current reward
QUESTION
I am trying to change the cell colour if the cell contains a string from a list of strings:
This allows me to change the colour if there is a match but it doesn't appear to go through every item in the list it only does the first match (i think this is because of the ==)
...ANSWER
Answered 2021-May-27 at 14:07Replace any cell when its content matches techniques
:
QUESTION
I'm trying to develop an efficient method to perform logical AND operation among several BigInteger values. For example, let us consider the snippet below:
...ANSWER
Answered 2021-May-18 at 19:39If I understand what you're trying to do correctly, then this is what the reduce
method of a Stream
is for.
For example, the following should work:
QUESTION
I need to define some additional properties to be used in maven plugin configurations (pom.xml). Is this possible in a programmatic way using Java code? The exec:java goal seems to run code directly inside the maven process. Is there any way to exploit this?
I need the project basedir property with forward slashes such that I can use it in a wildfly CLI script resource to set up a WildFly database resource. The database resource should point to an absolute path, ie. build output directory or basedir.
This is the script:
...ANSWER
Answered 2021-May-26 at 21:48There is no easy way to do that, afaik. Maven is a great tool as long as you respect the way it works, if you don't you're headed for trouble. Perhaps you could add some more details to your question, so we could understand what you really need.
What I can think of is to use the GMaven Plugin or the AntRun plugin to embed either Groovy or ant code in your pom.xml. Both of them can interact with the project object, which means they can manipulate properties. But it's not going to be easy, and your mileage may vary.
QUESTION
I'm quite confused on how to implement parameters in additive synthesis.
I'm trying to implement a system where I can sequence the following parameters: arbitrary number of partials, base frequency. I'm not sure of the feasibility of the arbitrary number of partials, but sequencing the base frequency should be indeed totally possible in my opinion.
Here is the code I'm working on:
...ANSWER
Answered 2021-May-25 at 13:38Mix.fill creates an array one time, when the Synth is created, so you can't dynamically change the size of the array by using a Synth argument.
Your bottom example also declares nn
as a variable inside the z
function, which means that amp = 0.5/nil
One possible solution is make many SynthDefs. Let's say that you know that you that minimum number of SinOscs you want is 2 and the maximum is 25.
QUESTION
If we pose a question "Why not use a non-expiring access token, and not bother with a refresh token?", the answer would probably be "Because if an access token is stolen, the malicious actor has X time (the lifetime of the said non-expiring access token) to perform malicious acts on behalf of the user that token was generated for." So the way that problem is solved, as far as I understand, is by, on successful authentication, sending the user a token-pair of a short lived access token, and a longer lived refresh token. I don't see how this isn't just an attempt at circumventing the original problem. The problem apparently lies in the theoretical possibility of the access token being stolen. So that if it ever is, it's validity expires quickly, so the malicious actor can't be authenticated for a long time. In this hypothetical situation, if whoever can steal the access token, why can't they steal the refresh token instead? The usual answers I got were something along the lines of:
- "You have to store the refresh token in a safe place." This makes no sense to me. Why wouldn't I store both the access token and refresh token in a "safe place"?
- "The access token has a higher chance of being stolen because it's used more often than a refresh token". In this case, I suspect that "stolen" means "sniffed", as in a Man in the Middle attack. I have a few sub-questions about this one. 1. Why is this applicable? Aren't HTTPS headers/body encrypted? If HTTP is assumed in this question, why are we even talking about protecting against vulnerabilities? Which leads nicely into: 2. In practice, how does this "sniffing" of requests look like? Why wouldn't the malicious actor be able "sniff" every single request being sent, and eventually find the refresh token one?
- "In a microservice environment, the access token is sent to all services, while the refresh token is sent only to the authorization service/server." This sounds like the most valid of all, but I still have a question. What difference does this make? It sounds like the authorization server is assumed to have greater security than other servers? I guess it makes sense only when taking a statistical approach, because to steal an access token, any of the X servers need to be exploited, while to steal a refresh token, only one server needs to be exploited. Although this is just my assumption, and it somehow doesn't fit in with the point of this security concept. Also, it doesn't seem like this concept was created to solve a server issue.
I guess my question is:
"If we assume that there are any inherent vulnerabilities with the concept of the access token, or with using it, or with how it's stored etc... What makes the refresh token less susceptible to these vulnerabilities?"
...ANSWER
Answered 2021-May-24 at 07:01Whilst the security properties of both the access token and the refresh token "at rest" are the same indeed, the difference is that "in transit" a refresh token is easier to secure than an access token because of the way it is used, as explained below.
Firstly the access token is only ever sent to the Resource Server(s), the refresh token is only ever used towards a single Authorization Server. A Resource Server is considered less trusted in many scenario's (the Authorization Server is - by design - a trusted component for the Client) and as you mention, there may be a lot of them which may have different levels of security that apply to them.
Secondly, the refresh token flow towards the Authorization Server may use a "rolling refresh" of the refresh token which means that at the time of access token refresh, a new refresh token is issued as well, which invalidates the old refresh token. This is a pretty common implementation pattern for Authorization Servers.
Lastly, and perhaps a bit of a long shot, the access token is used in many more requests than the refresh token so the chances of any vulnerability that applies to the transport layer (timing attacks) are proportionally increased.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install Exploit
You can use Exploit like any standard Python library. You will need to make sure that you have a development environment consisting of a Python distribution including header files, a compiler, pip, and git installed. Make sure that your pip, setuptools, and wheel are up to date. When using pip it is generally recommended to install packages in a virtual environment to avoid changes to the system.
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page