Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 14 additions & 10 deletions gui/velociraptor/src/components/users/user-label.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import PropTypes from 'prop-types';
import ButtonGroup from 'react-bootstrap/ButtonGroup';
import Button from 'react-bootstrap/Button';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';

import { withRouter } from "react-router-dom";

import Accordion from 'react-bootstrap/Accordion';
Expand Down Expand Up @@ -223,7 +222,6 @@ class UserSettingsDialog extends React.PureComponent {
}

render() {

return (
<Modal show={true}
dialogClassName="modal-70w"
Expand All @@ -240,14 +238,20 @@ class UserSettingsDialog extends React.PureComponent {
</ToolTip>
</Form.Label>
<Col sm="8">
<Form.Control as="select"
value={this.state.org}
placeholder={T("Select an org")}
onChange={e=>this.changeOrg(e.currentTarget.value)}>
{_.map(this.context.traits.orgs || [], function(x) {
return <option key={x.id} value={x.id}>{x.name}</option>;
})}
</Form.Control>
<Select
value={this.state.org}
placeholder={T("Select an org")}
classNamePrefix="velo"
onChange={e=>this.changeOrg(e.value)}
spellCheck="false"
options={_.map(_.sortBy(
this.context.traits.orgs, x=>x.name) || [],
k=>{
return {value: k.id,
label: k.name,
isFixed: true};
})}
/>
</Col>
</Form.Group>
}
Expand Down
7 changes: 6 additions & 1 deletion magefile.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,12 @@ var (
musl_xcompiler = "musl-gcc"
name = "velociraptor"
version = "v" + constants.VERSION
base_tags = " server_vql extras "

// https://github.com/googleapis/google-cloud-go/issues/11448
// google cloud suddenly increased its dependency size by about
// 20mb without warning. This little documented tag is used to
// remove useless bloat.
base_tags = " server_vql extras disable_grpc_modules "
)

func ReadAllWithLimit(
Expand Down
17 changes: 17 additions & 0 deletions utils/readers.go
Original file line number Diff line number Diff line change
Expand Up @@ -188,3 +188,20 @@ func NewOffsetReader(reader io.ReaderAt, offset, size int64) io.ReaderAt {
length: offset + size,
}
}

type CountingReader struct {
Reader io.Reader
Count int
}

func (self *CountingReader) Read(b []byte) (n int, err error) {
n, err = self.Reader.Read(b)
self.Count += n
return n, err
}

func NewCountingReader(r io.Reader) *CountingReader {
return &CountingReader{
Reader: r,
}
}
10 changes: 7 additions & 3 deletions vql/tools/webdav_upload.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import (
"www.velocidex.com/golang/velociraptor/artifacts"
"www.velocidex.com/golang/velociraptor/constants"
"www.velocidex.com/golang/velociraptor/uploads"
"www.velocidex.com/golang/velociraptor/utils"
"www.velocidex.com/golang/velociraptor/vql"
vql_subsystem "www.velocidex.com/golang/velociraptor/vql"
"www.velocidex.com/golang/velociraptor/vql/networking"
Expand Down Expand Up @@ -148,8 +149,10 @@ func upload_webdav(ctx context.Context, scope vfilter.Scope,
}
}

count_reader := utils.NewCountingReader(reader)

req, err := http.NewRequestWithContext(ctx,
http.MethodPut, parsedUrl.String(), reader)
http.MethodPut, parsedUrl.String(), count_reader)
if err != nil {
return &uploads.UploadResponse{
Error: err.Error(),
Expand All @@ -173,8 +176,9 @@ func upload_webdav(ctx context.Context, scope vfilter.Scope,
scope.Log("upload_webdav: HTTP status %v", resp.StatusCode)

return &uploads.UploadResponse{
Path: name,
Size: uint64(size),
Path: name,
Size: uint64(size),
StoredSize: uint64(count_reader.Count),
}, nil
}

Expand Down
Loading